From: Witold Kręcicki Date: Tue, 3 Apr 2018 11:10:15 +0000 (+0200) Subject: libdns refactoring: get rid of 3 versions of dns_cache_create X-Git-Tag: v9.13.0~70^2~14 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d39b3209fbd07245441da61bf2188f5eac824820;p=thirdparty%2Fbind9.git libdns refactoring: get rid of 3 versions of dns_cache_create --- diff --git a/bin/named/server.c b/bin/named/server.c index 99f11bc92c4..7240d5f8c05 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -4208,10 +4208,10 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, isc_mem_setname(cmctx, "cache", NULL); CHECK(isc_mem_create(0, 0, &hmctx)); isc_mem_setname(hmctx, "cache_heap", NULL); - CHECK(dns_cache_create3(cmctx, hmctx, named_g_taskmgr, - named_g_timermgr, view->rdclass, - cachename, "rbt", 0, NULL, - &cache)); + CHECK(dns_cache_create(cmctx, hmctx, named_g_taskmgr, + named_g_timermgr, view->rdclass, + cachename, "rbt", 0, NULL, + &cache)); isc_mem_detach(&cmctx); isc_mem_detach(&hmctx); } diff --git a/bin/tests/optional/adb_test.c b/bin/tests/optional/adb_test.c index 97bf3cfaf98..0d6995d9c36 100644 --- a/bin/tests/optional/adb_test.c +++ b/bin/tests/optional/adb_test.c @@ -180,8 +180,9 @@ create_view(void) { * Cache. */ cache = NULL; - result = dns_cache_create(mctx, taskmgr, timermgr, dns_rdataclass_in, - "rbt", 0, NULL, &cache); + result = dns_cache_create(mctx, mctx, taskmgr, timermgr, + dns_rdataclass_in, "", "rbt", 0, NULL, + &cache); check_result(result, "dns_cache_create"); dns_view_setcache(view, cache); dns_cache_detach(&cache); diff --git a/bin/tests/optional/byaddr_test.c b/bin/tests/optional/byaddr_test.c index 39b8b253e94..7d95c05bb5f 100644 --- a/bin/tests/optional/byaddr_test.c +++ b/bin/tests/optional/byaddr_test.c @@ -132,8 +132,8 @@ main(int argc, char *argv[]) { RUNTIME_CHECK(isc_socketmgr_create(mctx, &socketmgr) == ISC_R_SUCCESS); cache = NULL; - RUNTIME_CHECK(dns_cache_create(mctx, taskmgr, timermgr, - dns_rdataclass_in, "rbt", 0, NULL, + RUNTIME_CHECK(dns_cache_create(mctx, mctx, taskmgr, timermgr, + dns_rdataclass_in, "", "rbt", 0, NULL, &cache) == ISC_R_SUCCESS); view = NULL; diff --git a/bin/tests/optional/byname_test.c b/bin/tests/optional/byname_test.c index fb4b2b8413c..89c9a263dd2 100644 --- a/bin/tests/optional/byname_test.c +++ b/bin/tests/optional/byname_test.c @@ -250,8 +250,8 @@ main(int argc, char *argv[]) { RUNTIME_CHECK(isc_socketmgr_create(mctx, &socketmgr) == ISC_R_SUCCESS); cache = NULL; - RUNTIME_CHECK(dns_cache_create(mctx, taskmgr, timermgr, - dns_rdataclass_in, "rbt", 0, NULL, + RUNTIME_CHECK(dns_cache_create(mctx, mctx, taskmgr, timermgr, + dns_rdataclass_in, "", "rbt", 0, NULL, &cache) == ISC_R_SUCCESS); view = NULL; diff --git a/lib/dns/cache.c b/lib/dns/cache.c index ce40969889b..d37a018d090 100644 --- a/lib/dns/cache.c +++ b/lib/dns/cache.c @@ -176,31 +176,10 @@ cache_create_db(dns_cache_t *cache, dns_db_t **db) { } isc_result_t -dns_cache_create(isc_mem_t *cmctx, isc_taskmgr_t *taskmgr, +dns_cache_create(isc_mem_t *cmctx, isc_mem_t *hmctx, isc_taskmgr_t *taskmgr, isc_timermgr_t *timermgr, dns_rdataclass_t rdclass, - const char *db_type, unsigned int db_argc, char **db_argv, - dns_cache_t **cachep) -{ - return (dns_cache_create3(cmctx, cmctx, taskmgr, timermgr, rdclass, "", - db_type, db_argc, db_argv, cachep)); -} - -isc_result_t -dns_cache_create2(isc_mem_t *cmctx, isc_taskmgr_t *taskmgr, - isc_timermgr_t *timermgr, dns_rdataclass_t rdclass, - const char *cachename, const char *db_type, - unsigned int db_argc, char **db_argv, dns_cache_t **cachep) -{ - return (dns_cache_create3(cmctx, cmctx, taskmgr, timermgr, rdclass, - cachename, db_type, db_argc, db_argv, - cachep)); -} - -isc_result_t -dns_cache_create3(isc_mem_t *cmctx, isc_mem_t *hmctx, isc_taskmgr_t *taskmgr, - isc_timermgr_t *timermgr, dns_rdataclass_t rdclass, - const char *cachename, const char *db_type, - unsigned int db_argc, char **db_argv, dns_cache_t **cachep) + const char *cachename, const char *db_type, + unsigned int db_argc, char **db_argv, dns_cache_t **cachep) { isc_result_t result; dns_cache_t *cache; diff --git a/lib/dns/include/dns/cache.h b/lib/dns/include/dns/cache.h index 290a4e801b2..74b3b32f081 100644 --- a/lib/dns/include/dns/cache.h +++ b/lib/dns/include/dns/cache.h @@ -55,22 +55,11 @@ ISC_LANG_BEGINDECLS /*** *** Functions ***/ - isc_result_t -dns_cache_create(isc_mem_t *cmctx, isc_taskmgr_t *taskmgr, +dns_cache_create(isc_mem_t *cmctx, isc_mem_t *hmctx, isc_taskmgr_t *taskmgr, isc_timermgr_t *timermgr, dns_rdataclass_t rdclass, - const char *db_type, unsigned int db_argc, char **db_argv, - dns_cache_t **cachep); -isc_result_t -dns_cache_create2(isc_mem_t *cmctx, isc_taskmgr_t *taskmgr, - isc_timermgr_t *timermgr, dns_rdataclass_t rdclass, - const char *cachename, const char *db_type, - unsigned int db_argc, char **db_argv, dns_cache_t **cachep); -isc_result_t -dns_cache_create3(isc_mem_t *cmctx, isc_mem_t *hmctx, isc_taskmgr_t *taskmgr, - isc_timermgr_t *timermgr, dns_rdataclass_t rdclass, - const char *cachename, const char *db_type, - unsigned int db_argc, char **db_argv, dns_cache_t **cachep); + const char *cachename, const char *db_type, + unsigned int db_argc, char **db_argv, dns_cache_t **cachep); /*%< * Create a new DNS cache. * diff --git a/lib/dns/win32/libdns.def.in b/lib/dns/win32/libdns.def.in index 8b4f811b7a2..440af9b98a5 100644 --- a/lib/dns/win32/libdns.def.in +++ b/lib/dns/win32/libdns.def.in @@ -73,8 +73,6 @@ dns_cache_attach dns_cache_attachdb dns_cache_clean dns_cache_create -dns_cache_create2 -dns_cache_create3 dns_cache_detach dns_cache_dump dns_cache_dumpstats diff --git a/lib/ns/tests/nstest.c b/lib/ns/tests/nstest.c index 620636d8f5b..696ddd2b82f 100644 --- a/lib/ns/tests/nstest.c +++ b/lib/ns/tests/nstest.c @@ -321,8 +321,8 @@ ns_test_makeview(const char *name, isc_boolean_t with_cache, CHECK(dns_view_create(mctx, dns_rdataclass_in, name, &view)); if (with_cache) { - CHECK(dns_cache_create(mctx, taskmgr, timermgr, - dns_rdataclass_in, "rbt", 0, NULL, + CHECK(dns_cache_create(mctx, mctx, taskmgr, timermgr, + dns_rdataclass_in, "", "rbt", 0, NULL, &cache)); dns_view_setcache(view, cache); /*