Rename isc_tlsctx_cache_new() -> isc_tlsctx_cache_create()

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.
This commit is contained in:
Artem Boldariev 2022-12-22 19:54:16 +02:00
parent 6dede665c7
commit f102df96b8
6 changed files with 13 additions and 11 deletions

View 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);

View 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);

View 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,

View 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

View 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

View 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)