From 982d15f56291a0a9e624dac568d0366166431494 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Thu, 19 Jul 2012 17:46:34 -0400 Subject: 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. --- src/tests/sysdb-tests.c | 42 +++++++++++++++--------------------------- 1 file changed, 15 insertions(+), 27 deletions(-) diff --git a/src/tests/sysdb-tests.c b/src/tests/sysdb-tests.c index b4ac04934..bf7f157ed 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)); -- cgit