]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Rename isc_tlsctx_cache_new() -> isc_tlsctx_cache_create()
authorArtem Boldariev <artem@boldariev.com>
Thu, 22 Dec 2022 17:54:16 +0000 (19:54 +0200)
committerArtem Boldariev <artem@boldariev.com>
Fri, 23 Dec 2022 09:10:11 +0000 (11:10 +0200)
Additionally to renaming, it changes the function definition so that
it accepts a pointer to pointer instead of returning a pointer to the
new object.

It is mostly done to make it in line with other functions in the
module.

bin/dig/dighost.c
bin/named/server.c
bin/nsupdate/nsupdate.c
lib/isc/include/isc/tls.h
lib/isc/tls.c
tests/dns/dispatch_test.c

index 217dd3e6f8f2d401fa06cd0576f595fd674d6c7d..41a001054b65d3a3a255097e2afc8116ccaff850 100644 (file)
@@ -630,7 +630,7 @@ make_empty_lookup(void) {
        ISC_LIST_INIT(looknew->q);
        ISC_LIST_INIT(looknew->my_server_list);
 
-       looknew->tls_ctx_cache = isc_tlsctx_cache_new(mctx);
+       isc_tlsctx_cache_create(mctx, &looknew->tls_ctx_cache);
 
        isc_refcount_init(&looknew->references, 1);
 
index 3027bafe755335bb5878dfda50f323a638780899..7019256dd30dd02fb6985fc36a4aab02b0e7c2ae 100644 (file)
@@ -8448,13 +8448,13 @@ load_configuration(const char *filename, named_server_t *server,
                isc_tlsctx_cache_detach(&server->tlsctx_server_cache);
        }
 
-       server->tlsctx_server_cache = isc_tlsctx_cache_new(named_g_mctx);
+       isc_tlsctx_cache_create(named_g_mctx, &server->tlsctx_server_cache);
 
        if (server->tlsctx_client_cache != NULL) {
                isc_tlsctx_cache_detach(&server->tlsctx_client_cache);
        }
 
-       server->tlsctx_client_cache = isc_tlsctx_cache_new(named_g_mctx);
+       isc_tlsctx_cache_create(named_g_mctx, &server->tlsctx_client_cache);
 
        dns_zonemgr_set_tlsctx_cache(server->zonemgr,
                                     server->tlsctx_client_cache);
index de98154ef0e74dbaeb47abddbe6957689e9afada..55c1ae343dd5b193b2521369b83e0b54ca1bd172 100644 (file)
@@ -967,7 +967,7 @@ setup_system(void) {
        }
        transport_list = dns_transport_list_new(gmctx);
 
-       tls_ctx_cache = isc_tlsctx_cache_new(gmctx);
+       isc_tlsctx_cache_create(gmctx, &tls_ctx_cache);
 
        if (tls_client_key_file == NULL) {
                result = create_name("tls-non-auth-client", namedata,
index 24577ec13d7bd1a956649ac0783024a3e8297d79..113d603229fc38a7c2d12b7a1b7b52e4cc274cc3 100644 (file)
@@ -466,13 +466,14 @@ typedef enum {
 } isc_tlsctx_cache_transport_t;
 /*%< TLS context cache transport type values. */
 
-isc_tlsctx_cache_t *
-isc_tlsctx_cache_new(isc_mem_t *mctx);
+void
+isc_tlsctx_cache_create(isc_mem_t *mctx, isc_tlsctx_cache_t **cachep);
 /*%<
  * Create a new TLS context cache object.
  *
  * Requires:
- *\li  'mctx' is a valid memory context.
+ *\li  'mctx' is a valid memory context;
+ *\li  'cachep' is a valid pointer to a pointer which must be equal to NULL.
  */
 
 void
index a7d9a933327e1cef382f6783e6c85f1de00dd465..6a9605928c20ccc60bff7a677898aea62b5461ed 100644 (file)
@@ -1174,10 +1174,11 @@ struct isc_tlsctx_cache {
        isc_ht_t *data;
 };
 
-isc_tlsctx_cache_t *
-isc_tlsctx_cache_new(isc_mem_t *mctx) {
+void
+isc_tlsctx_cache_create(isc_mem_t *mctx, isc_tlsctx_cache_t **cachep) {
        isc_tlsctx_cache_t *nc;
 
+       REQUIRE(cachep != NULL && *cachep == NULL);
        nc = isc_mem_get(mctx, sizeof(*nc));
 
        *nc = (isc_tlsctx_cache_t){ .magic = TLSCTX_CACHE_MAGIC };
@@ -1187,7 +1188,7 @@ isc_tlsctx_cache_new(isc_mem_t *mctx) {
        isc_ht_init(&nc->data, mctx, 5, ISC_HT_CASE_SENSITIVE);
        isc_rwlock_init(&nc->rwlock, 0, 0);
 
-       return (nc);
+       *cachep = nc;
 }
 
 void
index 649166bf2533b7140dc4c09513a20ef53d037db9..ed046db9f13254f1b97d9e10cdd29bbe5ca073b6 100644 (file)
@@ -181,7 +181,7 @@ setup_test(void **state) {
        testdata.region.length = sizeof(testdata.rbuf);
        memset(testdata.message, 0, sizeof(testdata.message));
 
-       tls_tlsctx_client_cache = isc_tlsctx_cache_new(mctx);
+       isc_tlsctx_cache_create(mctx, &tls_tlsctx_client_cache);
 
        if (isc_tlsctx_createserver(NULL, NULL, &tls_listen_tlsctx) !=
            ISC_R_SUCCESS)