summaryrefslogtreecommitdiffstats
path: root/src/tests/sysdb-tests.c
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2012-07-19 17:46:34 -0400
committerJakub Hrozek <jhrozek@redhat.com>2012-08-01 22:24:44 +0200
commit982d15f56291a0a9e624dac568d0366166431494 (patch)
tree95fce886ba3f78b208b1ad4282a396d91fe93b1e /src/tests/sysdb-tests.c
parentb58460076fe843c11d736ae244c1ac979a6473a4 (diff)
downloadsssd_unused-982d15f56291a0a9e624dac568d0366166431494.tar.gz
sssd_unused-982d15f56291a0a9e624dac568d0366166431494.tar.xz
sssd_unused-982d15f56291a0a9e624dac568d0366166431494.zip
tests: Remove useless consts
Declaring a bunch of structures as const and then wrapping all uses in discard_const_p() is a bit silly. Remove all these useless decorations.
Diffstat (limited to 'src/tests/sysdb-tests.c')
-rw-r--r--src/tests/sysdb-tests.c42
1 files changed, 15 insertions, 27 deletions
diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c
index b4ac0493..bf7f157e 100644
--- a/src/tests/sysdb-tests.c
+++ b/src/tests/sysdb-tests.c
@@ -3388,15 +3388,9 @@ START_TEST(test_sysdb_original_dn_case_insensitive)
}
END_TEST
-const struct sysdb_subdom dom1 = {discard_const("dom1.sub"),
- discard_const("dom1"),
- discard_const("S-1")};
-const struct sysdb_subdom dom2 = {discard_const("dom2.sub"),
- discard_const("dom2"),
- discard_const("S-2")};
-const struct sysdb_subdom dom_t = {discard_const("test.sub"),
- discard_const("test"),
- discard_const("S-3")};
+struct sysdb_subdom dom1 = { "dom1.sub", "dom1", "S-1" };
+struct sysdb_subdom dom2 = { "dom2.sub", "dom2", "S-2" };
+struct sysdb_subdom dom_t = { "test.sub", "test", "S-3" };
START_TEST(test_sysdb_subdomain_create)
{
@@ -3404,9 +3398,9 @@ START_TEST(test_sysdb_subdomain_create)
errno_t ret;
struct sysdb_subdom **cur_subdomains = NULL;
size_t cur_subdomains_count;
- const struct sysdb_subdom *new_subdom1[] = { &dom1, NULL};
- const struct sysdb_subdom *new_subdom2[] = { &dom2, NULL};
- const struct sysdb_subdom *empty[] = { NULL};
+ struct sysdb_subdom *new_subdom1[] = { &dom1, NULL};
+ struct sysdb_subdom *new_subdom2[] = { &dom2, NULL};
+ struct sysdb_subdom *empty[] = { NULL};
ret = setup_sysdb_tests(&test_ctx);
fail_if(ret != EOK, "Could not set up the test");
@@ -3418,8 +3412,7 @@ START_TEST(test_sysdb_subdomain_create)
fail_unless(cur_subdomains != NULL, "No sub-domains returned.");
fail_unless(cur_subdomains[0] == NULL, "No empyt sub-domain list returned.");
- ret = sysdb_update_subdomains(test_ctx->sysdb,
- discard_const_p(struct sysdb_subdom *, new_subdom1));
+ ret = sysdb_update_subdomains(test_ctx->sysdb, new_subdom1);
fail_unless(ret == EOK, "sysdb_update_subdomains failed with [%d][%s]",
ret, strerror(ret));
@@ -3433,8 +3426,7 @@ START_TEST(test_sysdb_subdomain_create)
"Unexpected sub-domain found, expected [%s], got [%s]",
new_subdom1[0]->name, cur_subdomains[0]->name);
- ret = sysdb_update_subdomains(test_ctx->sysdb,
- discard_const_p(struct sysdb_subdom *, new_subdom2));
+ ret = sysdb_update_subdomains(test_ctx->sysdb, new_subdom2);
fail_unless(ret == EOK, "sysdb_update_subdomains failed with [%d][%s]",
ret, strerror(ret));
@@ -3448,8 +3440,7 @@ START_TEST(test_sysdb_subdomain_create)
"Unexpected sub-domain found, expected [%s], got [%s]",
new_subdom2[0]->name, cur_subdomains[0]->name);
- ret = sysdb_update_subdomains(test_ctx->sysdb,
- discard_const_p(struct sysdb_subdom *, empty));
+ ret = sysdb_update_subdomains(test_ctx->sysdb, empty);
fail_unless(ret == EOK, "sysdb_update_subdomains failed with [%d][%s]",
ret, strerror(ret));
@@ -3466,7 +3457,7 @@ START_TEST(test_sysdb_subdomain_store_user)
{
struct sysdb_test_ctx *test_ctx;
errno_t ret;
- const struct sysdb_subdom *test_subdom[] = { &dom_t, NULL};
+ struct sysdb_subdom *test_subdom[] = { &dom_t, NULL};
struct sss_domain_info *subdomain = NULL;
struct ldb_result *results = NULL;
struct ldb_dn *base_dn = NULL;
@@ -3475,8 +3466,7 @@ START_TEST(test_sysdb_subdomain_store_user)
ret = setup_sysdb_tests(&test_ctx);
fail_if(ret != EOK, "Could not set up the test");
- ret = sysdb_update_subdomains(test_ctx->sysdb,
- discard_const_p(struct sysdb_subdom *, test_subdom));
+ ret = sysdb_update_subdomains(test_ctx->sysdb, test_subdom);
fail_unless(ret == EOK, "sysdb_update_subdomains failed with [%d][%s]",
ret, strerror(ret));
@@ -3522,7 +3512,7 @@ START_TEST(test_sysdb_subdomain_user_ops)
{
struct sysdb_test_ctx *test_ctx;
errno_t ret;
- const struct sysdb_subdom *test_subdom[] = { &dom_t, NULL};
+ struct sysdb_subdom *test_subdom[] = { &dom_t, NULL};
struct sss_domain_info *subdomain = NULL;
struct ldb_message *msg = NULL;
struct ldb_dn *check_dn = NULL;
@@ -3530,8 +3520,7 @@ START_TEST(test_sysdb_subdomain_user_ops)
ret = setup_sysdb_tests(&test_ctx);
fail_if(ret != EOK, "Could not set up the test");
- ret = sysdb_update_subdomains(test_ctx->sysdb,
- discard_const_p(struct sysdb_subdom *, test_subdom));
+ ret = sysdb_update_subdomains(test_ctx->sysdb, test_subdom);
fail_unless(ret == EOK, "sysdb_update_subdomains failed with [%d][%s]",
ret, strerror(ret));
@@ -3572,7 +3561,7 @@ START_TEST(test_sysdb_subdomain_group_ops)
{
struct sysdb_test_ctx *test_ctx;
errno_t ret;
- const struct sysdb_subdom *test_subdom[] = { &dom_t, NULL};
+ struct sysdb_subdom *test_subdom[] = { &dom_t, NULL};
struct sss_domain_info *subdomain = NULL;
struct ldb_message *msg = NULL;
struct ldb_dn *check_dn = NULL;
@@ -3580,8 +3569,7 @@ START_TEST(test_sysdb_subdomain_group_ops)
ret = setup_sysdb_tests(&test_ctx);
fail_if(ret != EOK, "Could not set up the test");
- ret = sysdb_update_subdomains(test_ctx->sysdb,
- discard_const_p(struct sysdb_subdom *, test_subdom));
+ ret = sysdb_update_subdomains(test_ctx->sysdb, test_subdom);
fail_unless(ret == EOK, "sysdb_update_subdomains failed with [%d][%s]",
ret, strerror(ret));