]> 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 11:58:14 +0000 (13:58 +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.

(cherry picked from commit f102df96b86ba3658aa2a6594fbffd6c1e2ec309)

bin/dig/dighost.c
bin/named/server.c
lib/isc/include/isc/tls.h
lib/isc/tls.c

index 638e83b0a68fc93686d989fc16e07c4962c85c16..ce5f8292d004c822ab265b0ad1ad993d48c436ae 100644 (file)
@@ -644,7 +644,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 7c534d32ba980a5e479bdc9e79bee7de2640aa9c..464a1708e59dd67226f1f1c337b0ecbfa077f831 100644 (file)
@@ -8608,13 +8608,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 dc2a53f936f6f829b7a1c69c7552582c75c0a9c1..a732c20b20ecd512e969ba3f72642cd0c867afb3 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 d438297457f4583d3eb25efd3b4c6d605ce95a1f..f2b597454f91b79473d40983ac0c38fd8bcd4bb3 100644 (file)
@@ -1101,10 +1101,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 };
@@ -1114,7 +1115,7 @@ isc_tlsctx_cache_new(isc_mem_t *mctx) {
        isc_ht_init(&nc->data, mctx, 5);
        isc_rwlock_init(&nc->rwlock, 0, 0);
 
-       return (nc);
+       *cachep = nc;
 }
 
 void