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)
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);
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);
} 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
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 };
isc_ht_init(&nc->data, mctx, 5);
isc_rwlock_init(&nc->rwlock, 0, 0);
- return (nc);
+ *cachep = nc;
}
void