isc_mutex_init returns 'void'
authorOndřej Surý <ondrej@sury.org>
Fri, 16 Nov 2018 14:33:22 +0000 (15:33 +0100)
committerWitold Kręcicki <wpk@isc.org>
Thu, 22 Nov 2018 11:51:49 +0000 (11:51 +0000)
74 files changed:
bin/dig/dighost.c
bin/dnssec/dnssec-signzone.c
bin/named/server.c
bin/named/statschannel.c
bin/named/unix/dlz_dlopen_driver.c
bin/named/win32/dlz_dlopen_driver.c
bin/tests/optional/adb_test.c
bin/tests/optional/mempool_test.c
bin/tests/optional/sig0_test.c
contrib/dlz/drivers/sdlz_helper.c
lib/dns/acl.c
lib/dns/adb.c
lib/dns/badcache.c
lib/dns/byaddr.c
lib/dns/cache.c
lib/dns/catz.c
lib/dns/client.c
lib/dns/dbtable.c
lib/dns/dispatch.c
lib/dns/dnsrps.c
lib/dns/dnstap.c
lib/dns/dyndb.c
lib/dns/ecdb.c
lib/dns/geoip.c
lib/dns/lib.c
lib/dns/lookup.c
lib/dns/master.c
lib/dns/masterdump.c
lib/dns/name.c
lib/dns/portlist.c
lib/dns/rdata/in_1/wks_11.c
lib/dns/request.c
lib/dns/resolver.c
lib/dns/rpz.c
lib/dns/rrl.c
lib/dns/sdb.c
lib/dns/sdlz.c
lib/dns/ssu.c
lib/dns/stats.c
lib/dns/tests/dispatch_test.c
lib/dns/validator.c
lib/dns/view.c
lib/dns/zone.c
lib/irs/context.c
lib/irs/getaddrinfo.c
lib/isc/counter.c
lib/isc/httpd.c
lib/isc/include/isc/queue.h
lib/isc/log.c
lib/isc/mem.c
lib/isc/mutexblock.c
lib/isc/pk11.c
lib/isc/pthreads/include/isc/condition.h
lib/isc/pthreads/include/isc/mutex.h
lib/isc/pthreads/mutex.c
lib/isc/quota.c
lib/isc/ratelimiter.c
lib/isc/result.c
lib/isc/rwlock.c
lib/isc/stats.c
lib/isc/task.c
lib/isc/tests/task_test.c
lib/isc/tests/timer_test.c
lib/isc/timer.c
lib/isc/unix/app.c
lib/isc/unix/socket.c
lib/isc/win32/app.c
lib/isc/win32/include/isc/mutex.h
lib/isc/win32/socket.c
lib/ns/client.c
lib/ns/interfacemgr.c
lib/ns/lib.c
lib/ns/query.c
lib/ns/stats.c

index 5d35e79..c362ba5 100644 (file)
@@ -1390,8 +1390,7 @@ setup_libs(void) {
        isc_mempool_setfreemax(commctx, 6);
        isc_mempool_setfillcount(commctx, 2);
 
-       result = isc_mutex_init(&lookup_lock);
-       check_result(result, "isc_mutex_init");
+       isc_mutex_init(&lookup_lock);
 }
 
 typedef struct dig_ednsoptname {
index c409ac2..d542390 100644 (file)
@@ -3874,9 +3874,11 @@ main(int argc, char *argv[]) {
                              isc_result_totext(result));
        }
 
-       RUNTIME_CHECK(isc_mutex_init(&namelock) == ISC_R_SUCCESS);
-       if (printstats)
-               RUNTIME_CHECK(isc_mutex_init(&statslock) == ISC_R_SUCCESS);
+       isc_mutex_init(&namelock);
+
+       if (printstats) {
+               isc_mutex_init(&statslock);
+       }
 
        presign();
        TIME_NOW(&sign_start);
index 4b1e6a3..7510422 100644 (file)
@@ -9615,8 +9615,8 @@ named_server_create(isc_mem_t *mctx, named_server_t **serverp) {
                                     &server->in_roothints),
                   "setting up root hints");
 
-       CHECKFATAL(isc_mutex_init(&server->reload_event_lock),
-                  "initializing reload event lock");
+       isc_mutex_init(&server->reload_event_lock);
+
        server->reload_event =
                isc_event_allocate(named_g_mctx, server,
                                   NAMED_EVENT_RELOAD,
index bd8d1c5..7e023f0 100644 (file)
@@ -3253,11 +3253,7 @@ add_listener(named_server_t *server, named_statschannel_t **listenerp,
        listener->mctx = NULL;
        ISC_LINK_INIT(listener, link);
 
-       result = isc_mutex_init(&listener->lock);
-       if (result != ISC_R_SUCCESS) {
-               isc_mem_put(server->mctx, listener, sizeof(*listener));
-               return (ISC_R_FAILURE);
-       }
+       isc_mutex_init(&listener->lock);
 
        isc_mem_attach(server->mctx, &listener->mctx);
 
index 5adb8d2..61602f3 100644 (file)
@@ -252,9 +252,7 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
        }
 
        /* Initialize the lock */
-       result = isc_mutex_init(&cd->lock);
-       if (result != ISC_R_SUCCESS)
-               goto failed;
+       isc_mutex_init(&cd->lock);
 
        /* Open the library */
        dlopen_flags = RTLD_NOW|RTLD_GLOBAL;
index bfc8605..650f56a 100644 (file)
@@ -253,9 +253,7 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
        triedload = true;
 
        /* Initialize the lock */
-       result = isc_mutex_init(&cd->lock);
-       if (result != ISC_R_SUCCESS)
-               goto failed;
+       isc_mutex_init(&cd->lock);
 
        /* Open the library */
        cd->dl_handle = LoadLibraryA(cd->dl_path);
index f871c21..8eeef45 100644 (file)
@@ -290,8 +290,8 @@ main(int argc, char **argv) {
 
        isc_stdtime_get(&now);
 
-       result = isc_mutex_init(&client_lock);
-       check_result(result, "isc_mutex_init(&client_lock)");
+       isc_mutex_init(&client_lock);
+
        ISC_LIST_INIT(clients);
 
        /*
index 6a878f4..f696ce0 100644 (file)
@@ -30,7 +30,7 @@ main(int argc, char *argv[]) {
 
        isc_mem_debugging = ISC_MEM_DEBUGRECORD;
 
-       RUNTIME_CHECK(isc_mutex_init(&lock) == ISC_R_SUCCESS);
+       isc_mutex_init(&lock);
 
        mctx = NULL;
        RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
index cf00896..3416f35 100644 (file)
@@ -206,7 +206,7 @@ main(int argc, char *argv[]) {
 
        RUNTIME_CHECK(isc_app_start() == ISC_R_SUCCESS);
 
-       RUNTIME_CHECK(isc_mutex_init(&lock) == ISC_R_SUCCESS);
+       isc_mutex_init(&lock);
 
        mctx = NULL;
        RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
index 6ed6269..c44f724 100644 (file)
@@ -35,7 +35,7 @@
 
 /*
  * Copyright (C) 1999-2001, 2016  Internet Systems Consortium, Inc. ("ISC")
- * 
+ *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
@@ -364,13 +364,7 @@ sdlzh_build_sqldbinstance(isc_mem_t *mctx, const char *allnodes_str,
        isc_mem_attach(mctx, &db->mctx);
 
        /* initialize the reference count mutex */
-       result = isc_mutex_init(&db->instance_lock);
-       if (result != ISC_R_SUCCESS) {
-               UNEXPECTED_ERROR(__FILE__, __LINE__,
-                                "isc_mutex_init() failed: %s",
-                                isc_result_totext(result));
-               goto cleanup;
-       }
+       isc_mutex_init(&db->instance_lock);
 
        /* build the all nodes query list */
        result = build_querylist(mctx, allnodes_str, &db->zone,
index f941512..7dfed5f 100644 (file)
@@ -498,7 +498,7 @@ static bool insecure_prefix_found;
 
 static void
 initialize_action(void) {
-       RUNTIME_CHECK(isc_mutex_init(&insecure_prefix_lock) == ISC_R_SUCCESS);
+       isc_mutex_init(&insecure_prefix_lock);
 }
 
 /*
index c9b8510..3e5bab9 100644 (file)
@@ -1895,7 +1895,6 @@ free_adbentry(dns_adb_t *adb, dns_adbentry_t **entry) {
 static inline dns_adbfind_t *
 new_adbfind(dns_adb_t *adb) {
        dns_adbfind_t *h;
-       isc_result_t result;
 
        h = isc_mempool_get(adb->ahmp);
        if (h == NULL)
@@ -1920,11 +1919,7 @@ new_adbfind(dns_adb_t *adb) {
        /*
         * private members
         */
-       result = isc_mutex_init(&h->lock);
-       if (result != ISC_R_SUCCESS) {
-               isc_mempool_put(adb->ahmp, h);
-               return (NULL);
-       }
+       isc_mutex_init(&h->lock);
 
        ISC_EVENT_INIT(&h->event, sizeof(isc_event_t), 0, 0, 0, NULL, NULL,
                       NULL, NULL, h);
@@ -2606,29 +2601,12 @@ dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_timermgr_t *timermgr,
 
        isc_mem_attach(mem, &adb->mctx);
 
-       result = isc_mutex_init(&adb->lock);
-       if (result != ISC_R_SUCCESS)
-               goto fail0b;
-
-       result = isc_mutex_init(&adb->mplock);
-       if (result != ISC_R_SUCCESS)
-               goto fail0c;
-
-       result = isc_mutex_init(&adb->reflock);
-       if (result != ISC_R_SUCCESS)
-               goto fail0d;
-
-       result = isc_mutex_init(&adb->overmemlock);
-       if (result != ISC_R_SUCCESS)
-               goto fail0e;
-
-       result = isc_mutex_init(&adb->entriescntlock);
-       if (result != ISC_R_SUCCESS)
-               goto fail0f;
-
-       result = isc_mutex_init(&adb->namescntlock);
-       if (result != ISC_R_SUCCESS)
-               goto fail0g;
+       isc_mutex_init(&adb->lock);
+       isc_mutex_init(&adb->mplock);
+       isc_mutex_init(&adb->reflock);
+       isc_mutex_init(&adb->overmemlock);
+       isc_mutex_init(&adb->entriescntlock);
+       isc_mutex_init(&adb->namescntlock);
 
 #define ALLOCENTRY(adb, el) \
        do { \
@@ -2790,17 +2768,11 @@ dns_adb_create(isc_mem_t *mem, dns_view_t *view, isc_timermgr_t *timermgr,
                isc_mempool_destroy(&adb->afmp);
 
        DESTROYLOCK(&adb->namescntlock);
- fail0g:
        DESTROYLOCK(&adb->entriescntlock);
- fail0f:
        DESTROYLOCK(&adb->overmemlock);
- fail0e:
        DESTROYLOCK(&adb->reflock);
- fail0d:
        DESTROYLOCK(&adb->mplock);
- fail0c:
        DESTROYLOCK(&adb->lock);
- fail0b:
        if (adb->excl != NULL)
                isc_task_detach(&adb->excl);
        isc_mem_putanddetach(&adb->mctx, adb, sizeof(dns_adb_t));
index a47b722..3802f60 100644 (file)
@@ -75,9 +75,7 @@ dns_badcache_init(isc_mem_t *mctx, unsigned int size, dns_badcache_t **bcp) {
        memset(bc, 0, sizeof(dns_badcache_t));
 
        isc_mem_attach(mctx, &bc->mctx);
-       result = isc_mutex_init(&bc->lock);
-       if (result != ISC_R_SUCCESS)
-               goto cleanup;
+       isc_mutex_init(&bc->lock);
 
        bc->table = isc_mem_get(bc->mctx, sizeof(*bc->table) * size);
        if (bc->table == NULL) {
@@ -97,7 +95,6 @@ dns_badcache_init(isc_mem_t *mctx, unsigned int size, dns_badcache_t **bcp) {
 
  destroy_lock:
        DESTROYLOCK(&bc->lock);
- cleanup:
        isc_mem_putanddetach(&bc->mctx, bc, sizeof(dns_badcache_t));
        return (result);
 }
index a91b347..63a5a9d 100644 (file)
@@ -224,9 +224,7 @@ dns_byaddr_create(isc_mem_t *mctx, const isc_netaddr_t *address,
        byaddr->task = NULL;
        isc_task_attach(task, &byaddr->task);
 
-       result = isc_mutex_init(&byaddr->lock);
-       if (result != ISC_R_SUCCESS)
-               goto cleanup_event;
+       isc_mutex_init(&byaddr->lock);
 
        dns_fixedname_init(&byaddr->name);
 
@@ -252,7 +250,6 @@ dns_byaddr_create(isc_mem_t *mctx, const isc_netaddr_t *address,
  cleanup_lock:
        DESTROYLOCK(&byaddr->lock);
 
- cleanup_event:
        ievent = (isc_event_t *)byaddr->event;
        isc_event_free(&ievent);
        byaddr->event = NULL;
index 6523c98..7a0b514 100644 (file)
@@ -212,13 +212,8 @@ dns_cache_create(isc_mem_t *cmctx, isc_mem_t *hmctx, isc_taskmgr_t *taskmgr,
                }
        }
 
-       result = isc_mutex_init(&cache->lock);
-       if (result != ISC_R_SUCCESS)
-               goto cleanup_mem;
-
-       result = isc_mutex_init(&cache->filelock);
-       if (result != ISC_R_SUCCESS)
-               goto cleanup_lock;
+       isc_mutex_init(&cache->lock);
+       isc_mutex_init(&cache->filelock);
 
        cache->references = 1;
        cache->live_tasks = 0;
@@ -313,26 +308,26 @@ dns_cache_create(isc_mem_t *cmctx, isc_mem_t *hmctx, isc_taskmgr_t *taskmgr,
        *cachep = cache;
        return (ISC_R_SUCCESS);
 
- cleanup_db:
+cleanup_db:
        dns_db_detach(&cache->db);
- cleanup_dbargv:
+cleanup_dbargv:
        for (i = extra; i < cache->db_argc; i++)
                if (cache->db_argv[i] != NULL)
                        isc_mem_free(cmctx, cache->db_argv[i]);
        if (cache->db_argv != NULL)
                isc_mem_put(cmctx, cache->db_argv,
                            cache->db_argc * sizeof(char *));
- cleanup_dbtype:
+cleanup_dbtype:
        isc_mem_free(cmctx, cache->db_type);
- cleanup_filelock:
+cleanup_filelock:
        DESTROYLOCK(&cache->filelock);
- cleanup_stats:
+cleanup_stats:
        isc_stats_detach(&cache->stats);
- cleanup_lock:
        DESTROYLOCK(&cache->lock);
- cleanup_mem:
-       if (cache->name != NULL)
+cleanup_mem:
+       if (cache->name != NULL) {
                isc_mem_free(cmctx, cache->name);
+       }
        isc_mem_detach(&cache->hmctx);
        isc_mem_putanddetach(&cache->mctx, cache, sizeof(*cache));
        return (result);
@@ -596,9 +591,7 @@ cache_cleaner_init(dns_cache_t *cache, isc_taskmgr_t *taskmgr,
 {
        isc_result_t result;
 
-       result = isc_mutex_init(&cleaner->lock);
-       if (result != ISC_R_SUCCESS)
-               goto fail;
+       isc_mutex_init(&cleaner->lock);
 
        cleaner->increment = DNS_CACHE_CLEANERINCREMENT;
        cleaner->state = cleaner_s_idle;
@@ -687,7 +680,7 @@ cache_cleaner_init(dns_cache_t *cache, isc_taskmgr_t *taskmgr,
        if (cleaner->iterator != NULL)
                dns_dbiterator_destroy(&cleaner->iterator);
        DESTROYLOCK(&cleaner->lock);
- fail:
+
        return (result);
 }
 
index ca42a55..a0a653f 100644 (file)
@@ -557,9 +557,7 @@ dns_catz_new_zones(dns_catz_zones_t **catzsp, dns_catz_zonemodmethods_t *zmm,
                return (ISC_R_NOMEMORY);
        memset(new_zones, 0, sizeof(*new_zones));
 
-       result = isc_mutex_init(&new_zones->lock);
-       if (result != ISC_R_SUCCESS)
-               goto cleanup_newzones;
+       isc_mutex_init(&new_zones->lock);
 
        isc_refcount_init(&new_zones->refs, 1);
 
@@ -584,7 +582,6 @@ dns_catz_new_zones(dns_catz_zones_t **catzsp, dns_catz_zonemodmethods_t *zmm,
   cleanup_refcount:
        isc_refcount_destroy(&new_zones->refs);
        isc_mutex_destroy(&new_zones->lock);
-  cleanup_newzones:
        isc_mem_put(mctx, new_zones, sizeof(*new_zones));
 
        return (result);
index 6c96a40..0ab615b 100644 (file)
@@ -450,11 +450,7 @@ dns_client_createx(isc_mem_t *mctx, isc_appctx_t *actx,
        if (client == NULL)
                return (ISC_R_NOMEMORY);
 
-       result = isc_mutex_init(&client->lock);
-       if (result != ISC_R_SUCCESS) {
-               isc_mem_put(mctx, client, sizeof(*client));
-               return (result);
-       }
+       isc_mutex_init(&client->lock);
 
        client->actx = actx;
        client->taskmgr = taskmgr;
@@ -1244,11 +1240,7 @@ dns_client_resolve(dns_client_t *client, const dns_name_t *name,
        if (resarg == NULL)
                return (ISC_R_NOMEMORY);
 
-       result = isc_mutex_init(&resarg->lock);
-       if (result != ISC_R_SUCCESS) {
-               isc_mem_put(client->mctx, resarg, sizeof(*resarg));
-               return (result);
-       }
+       isc_mutex_init(&resarg->lock);
 
        resarg->actx = actx;
        resarg->client = client;
@@ -1356,11 +1348,7 @@ dns_client_startresolve(dns_client_t *client, const dns_name_t *name,
        if (rctx == NULL)
                result = ISC_R_NOMEMORY;
        else {
-               result = isc_mutex_init(&rctx->lock);
-               if (result != ISC_R_SUCCESS) {
-                       isc_mem_put(mctx, rctx, sizeof(*rctx));
-                       rctx = NULL;
-               }
+               isc_mutex_init(&rctx->lock);
        }
        if (result != ISC_R_SUCCESS)
                goto cleanup;
@@ -1655,11 +1643,7 @@ dns_client_request(dns_client_t *client, dns_message_t *qmessage,
        if (reqarg == NULL)
                return (ISC_R_NOMEMORY);
 
-       result = isc_mutex_init(&reqarg->lock);
-       if (result != ISC_R_SUCCESS) {
-               isc_mem_put(client->mctx, reqarg, sizeof(*reqarg));
-               return (result);
-       }
+       isc_mutex_init(&reqarg->lock);
 
        reqarg->actx = actx;
        reqarg->client = client;
@@ -1761,11 +1745,7 @@ dns_client_startrequest(dns_client_t *client, dns_message_t *qmessage,
        if (ctx == NULL)
                result = ISC_R_NOMEMORY;
        else {
-               result = isc_mutex_init(&ctx->lock);
-               if (result != ISC_R_SUCCESS) {
-                       isc_mem_put(client->mctx, ctx, sizeof(*ctx));
-                       ctx = NULL;
-               }
+               isc_mutex_init(&ctx->lock);
        }
        if (result != ISC_R_SUCCESS)
                goto cleanup;
@@ -2714,11 +2694,7 @@ dns_client_update(dns_client_t *client, dns_rdataclass_t rdclass,
        if (uarg == NULL)
                return (ISC_R_NOMEMORY);
 
-       result = isc_mutex_init(&uarg->lock);
-       if (result != ISC_R_SUCCESS) {
-               isc_mem_put(client->mctx, uarg, sizeof(*uarg));
-               return (result);
-       }
+       isc_mutex_init(&uarg->lock);
 
        uarg->actx = actx;
        uarg->client = client;
@@ -2861,12 +2837,7 @@ dns_client_startupdate(dns_client_t *client, dns_rdataclass_t rdclass,
                return (ISC_R_NOMEMORY);
        }
 
-       result = isc_mutex_init(&uctx->lock);
-       if (result != ISC_R_SUCCESS) {
-               dns_view_detach(&view);
-               isc_mem_put(client->mctx, uctx, sizeof(*uctx));
-               return (ISC_R_NOMEMORY);
-       }
+       isc_mutex_init(&uctx->lock);
 
        tclone = NULL;
        isc_task_attach(task, &tclone);
index 43951d6..934baac 100644 (file)
@@ -67,9 +67,7 @@ dns_dbtable_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
        if (result != ISC_R_SUCCESS)
                goto clean1;
 
-       result = isc_mutex_init(&dbtable->lock);
-       if (result != ISC_R_SUCCESS)
-               goto clean2;
+       isc_mutex_init(&dbtable->lock);
 
        result = isc_rwlock_init(&dbtable->tree_lock, 0, 0);
        if (result != ISC_R_SUCCESS)
@@ -89,7 +87,6 @@ dns_dbtable_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
  clean3:
        DESTROYLOCK(&dbtable->lock);
 
- clean2:
        dns_rbt_destroy(&dbtable->rbt);
 
  clean1:
index 57c94ba..969153d 100644 (file)
@@ -1760,33 +1760,13 @@ dns_dispatchmgr_create(isc_mem_t *mctx, dns_dispatchmgr_t **mgrp)
        mgr->blackhole = NULL;
        mgr->stats = NULL;
 
-       result = isc_mutex_init(&mgr->lock);
-       if (result != ISC_R_SUCCESS)
-               goto deallocate;
-
-       result = isc_mutex_init(&mgr->buffer_lock);
-       if (result != ISC_R_SUCCESS)
-               goto kill_lock;
-
-       result = isc_mutex_init(&mgr->depool_lock);
-       if (result != ISC_R_SUCCESS)
-               goto kill_buffer_lock;
-
-       result = isc_mutex_init(&mgr->rpool_lock);
-       if (result != ISC_R_SUCCESS)
-               goto kill_depool_lock;
-
-       result = isc_mutex_init(&mgr->dpool_lock);
-       if (result != ISC_R_SUCCESS)
-               goto kill_rpool_lock;
-
-       result = isc_mutex_init(&mgr->bpool_lock);
-       if (result != ISC_R_SUCCESS)
-               goto kill_dpool_lock;
-
-       result = isc_mutex_init(&mgr->spool_lock);
-       if (result != ISC_R_SUCCESS)
-               goto kill_bpool_lock;
+       isc_mutex_init(&mgr->lock);
+       isc_mutex_init(&mgr->buffer_lock);
+       isc_mutex_init(&mgr->depool_lock);
+       isc_mutex_init(&mgr->rpool_lock);
+       isc_mutex_init(&mgr->dpool_lock);
+       isc_mutex_init(&mgr->bpool_lock);
+       isc_mutex_init(&mgr->spool_lock);
 
        mgr->depool = NULL;
        if (isc_mempool_create(mgr->mctx, sizeof(dns_dispatchevent_t),
@@ -1868,19 +1848,12 @@ dns_dispatchmgr_create(isc_mem_t *mctx, dns_dispatchmgr_t **mgrp)
        isc_mempool_destroy(&mgr->depool);
  kill_spool_lock:
        DESTROYLOCK(&mgr->spool_lock);
- kill_bpool_lock:
        DESTROYLOCK(&mgr->bpool_lock);
- kill_dpool_lock:
        DESTROYLOCK(&mgr->dpool_lock);
- kill_rpool_lock:
        DESTROYLOCK(&mgr->rpool_lock);
- kill_depool_lock:
        DESTROYLOCK(&mgr->depool_lock);
- kill_buffer_lock:
        DESTROYLOCK(&mgr->buffer_lock);
- kill_lock:
        DESTROYLOCK(&mgr->lock);
- deallocate:
        isc_mem_put(mctx, mgr, sizeof(dns_dispatchmgr_t));
        isc_mem_detach(&mctx);
 
@@ -2262,7 +2235,6 @@ qid_allocate(dns_dispatchmgr_t *mgr, unsigned int buckets,
 {
        dns_qid_t *qid;
        unsigned int i;
-       isc_result_t result;
 
        REQUIRE(VALID_DISPATCHMGR(mgr));
        REQUIRE(buckets < 2097169);  /* next prime > 65536 * 32 */
@@ -2292,17 +2264,7 @@ qid_allocate(dns_dispatchmgr_t *mgr, unsigned int buckets,
                }
        }
 
-       result = isc_mutex_init(&qid->lock);
-       if (result != ISC_R_SUCCESS) {
-               if (qid->sock_table != NULL) {
-                       isc_mem_put(mgr->mctx, qid->sock_table,
-                                   buckets * sizeof(dispsocketlist_t));
-               }
-               isc_mem_put(mgr->mctx, qid->qid_table,
-                           buckets * sizeof(dns_displist_t));
-               isc_mem_put(mgr->mctx, qid, sizeof(*qid));
-               return (result);
-       }
+       isc_mutex_init(&qid->lock);
 
        for (i = 0; i < buckets; i++) {
                ISC_LIST_INIT(qid->qid_table[i]);
@@ -2385,9 +2347,7 @@ dispatch_allocate(dns_dispatchmgr_t *mgr, unsigned int maxrequests,
        disp->portpool = NULL;
        disp->dscp = -1;
 
-       result = isc_mutex_init(&disp->lock);
-       if (result != ISC_R_SUCCESS)
-               goto deallocate;
+       isc_mutex_init(&disp->lock);
 
        disp->failsafe_ev = allocate_devent(disp);
        if (disp->failsafe_ev == NULL) {
@@ -2405,7 +2365,6 @@ dispatch_allocate(dns_dispatchmgr_t *mgr, unsigned int maxrequests,
         */
  kill_lock:
        DESTROYLOCK(&disp->lock);
- deallocate:
        isc_mempool_put(mgr->dpool, disp);
 
        return (result);
@@ -2987,10 +2946,7 @@ dispatch_createudp(dns_dispatchmgr_t *mgr, isc_socketmgr_t *sockmgr,
                goto kill_ctlevent;
        }
 
-       result = isc_mutex_init(&disp->sepool_lock);
-       if (result != ISC_R_SUCCESS) {
-               goto kill_sepool;
-       }
+       isc_mutex_init(&disp->sepool_lock);
 
        isc_mempool_setname(disp->sepool, "disp_sepool");
        isc_mempool_setmaxalloc(disp->sepool, 32768);
@@ -3020,8 +2976,6 @@ dispatch_createudp(dns_dispatchmgr_t *mgr, isc_socketmgr_t *sockmgr,
        /*
         * Error returns.
         */
- kill_sepool:
-       isc_mempool_destroy(&disp->sepool);
  kill_ctlevent:
        isc_event_free(&disp->ctlevent);
  kill_task:
@@ -3692,9 +3646,7 @@ dns_dispatchset_create(isc_mem_t *mctx, isc_socketmgr_t *sockmgr,
                return (ISC_R_NOMEMORY);
        memset(dset, 0, sizeof(*dset));
 
-       result = isc_mutex_init(&dset->lock);
-       if (result != ISC_R_SUCCESS)
-               goto fail_alloc;
+       isc_mutex_init(&dset->lock);
 
        dset->dispatches = isc_mem_get(mctx, sizeof(dns_dispatch_t *) * n);
        if (dset->dispatches == NULL) {
@@ -3738,8 +3690,6 @@ dns_dispatchset_create(isc_mem_t *mctx, isc_socketmgr_t *sockmgr,
 
  fail_lock:
        DESTROYLOCK(&dset->lock);
-
- fail_alloc:
        isc_mem_put(mctx, dset, sizeof(dns_dispatchset_t));
        return (result);
 }
index b217b79..f2027fb 100644 (file)
@@ -145,9 +145,7 @@ dns_dnsrps_server_create(void) {
        if (librpz == NULL)
                return (ISC_R_SUCCESS);
 
-       result = isc_mutex_init(&dnsrps_mutex);
-       if (result != ISC_R_SUCCESS)
-               return (result);
+       isc_mutex_init(&dnsrps_mutex);
 
        librpz->set_log(&dnsrps_log_fnc, NULL);
 
index d93e22d..3a91090 100644 (file)
@@ -142,7 +142,7 @@ static unsigned int generation;
 
 static void
 mutex_init(void) {
-       RUNTIME_CHECK(isc_mutex_init(&dt_mutex) == ISC_R_SUCCESS);
+       isc_mutex_init(&dt_mutex);
 }
 
 static void
index 93ad795..0faf393 100644 (file)
@@ -67,7 +67,7 @@ static isc_once_t once = ISC_ONCE_INIT;
 
 static void
 dyndb_initialize(void) {
-       RUNTIME_CHECK(isc_mutex_init(&dyndb_lock) == ISC_R_SUCCESS);
+       isc_mutex_init(&dyndb_lock);
        INIT_LIST(dyndb_implementations);
 }
 
index e75a624..cdf1a8e 100644 (file)
@@ -354,14 +354,7 @@ findnode(dns_db_t *db, const dns_name_t *name, bool create,
        if (node == NULL)
                return (ISC_R_NOMEMORY);
 
-       result = isc_mutex_init(&node->lock);
-       if (result != ISC_R_SUCCESS) {
-               UNEXPECTED_ERROR(__FILE__, __LINE__,
-                                "isc_mutex_init() failed: %s",
-                                isc_result_totext(result));
-               isc_mem_put(mctx, node, sizeof(*node));
-               return (ISC_R_UNEXPECTED);
-       }
+       isc_mutex_init(&node->lock);
 
        dns_name_init(&node->name, NULL);
        result = dns_name_dup(name, mctx, &node->name);
@@ -625,16 +618,7 @@ dns_ecdb_create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type,
                return (result);
        }
 
-       result = isc_mutex_init(&ecdb->lock);
-       if (result != ISC_R_SUCCESS) {
-               UNEXPECTED_ERROR(__FILE__, __LINE__,
-                                "isc_mutex_init() failed: %s",
-                                isc_result_totext(result));
-               if (dns_name_dynamic(&ecdb->common.origin))
-                       dns_name_free(&ecdb->common.origin, mctx);
-               isc_mem_put(mctx, ecdb, sizeof(*ecdb));
-               return (ISC_R_UNEXPECTED);
-       }
+       isc_mutex_init(&ecdb->lock);
 
        ecdb->references = 1;
        ISC_LIST_INIT(ecdb->nodes);
index 49bdd7f..140fe3b 100644 (file)
@@ -86,7 +86,7 @@ static isc_mem_t *state_mctx = NULL;
 
 static void
 key_mutex_init(void) {
-       RUNTIME_CHECK(isc_mutex_init(&key_mutex) == ISC_R_SUCCESS);
+       isc_mutex_init(&key_mutex);
 }
 
 static void
index 9bcf12b..a58b091 100644 (file)
@@ -91,15 +91,11 @@ initialize(void) {
        if (result != ISC_R_SUCCESS)
                goto cleanup_db;
 
-       result = isc_mutex_init(&reflock);
-       if (result != ISC_R_SUCCESS)
-               goto cleanup_dst;
+       isc_mutex_init(&reflock);
 
        initialize_done = true;
        return;
 
-  cleanup_dst:
-       dst_lib_destroy();
   cleanup_db:
        if (dbimp != NULL)
                dns_ecdb_unregister(&dbimp);
index 997d4ea..ecf9c8d 100644 (file)
@@ -410,9 +410,7 @@ dns_lookup_create(isc_mem_t *mctx, const dns_name_t *name, dns_rdatatype_t type,
        lookup->task = NULL;
        isc_task_attach(task, &lookup->task);
 
-       result = isc_mutex_init(&lookup->lock);
-       if (result != ISC_R_SUCCESS)
-               goto cleanup_event;
+       isc_mutex_init(&lookup->lock);
 
        dns_fixedname_init(&lookup->name);
 
@@ -438,8 +436,6 @@ dns_lookup_create(isc_mem_t *mctx, const dns_name_t *name, dns_rdatatype_t type,
 
  cleanup_lock:
        DESTROYLOCK(&lookup->lock);
-
- cleanup_event:
        ievent = (isc_event_t *)lookup->event;
        isc_event_free(&ievent);
        lookup->event = NULL;
index 875e5f7..ac4c137 100644 (file)
@@ -534,11 +534,7 @@ loadctx_create(dns_masterformat_t format, isc_mem_t *mctx,
        lctx = isc_mem_get(mctx, sizeof(*lctx));
        if (lctx == NULL)
                return (ISC_R_NOMEMORY);
-       result = isc_mutex_init(&lctx->lock);
-       if (result != ISC_R_SUCCESS) {
-               isc_mem_put(mctx, lctx, sizeof(*lctx));
-               return (result);
-       }
+       isc_mutex_init(&lctx->lock);
 
        lctx->inc = NULL;
        result = incctx_create(mctx, origin, &lctx->inc);
index e870d58..109bffd 100644 (file)
@@ -1527,9 +1527,8 @@ dumpctx_create(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version,
        if (result != ISC_R_SUCCESS)
                goto cleanup;
 
-       result = isc_mutex_init(&dctx->lock);
-       if (result != ISC_R_SUCCESS)
-               goto cleanup;
+       isc_mutex_init(&dctx->lock);
+
        if (version != NULL)
                dns_db_attachversion(dctx->db, version, &dctx->version);
        else if (!dns_db_iscache(db))
index 7445293..9b704c7 100644 (file)
@@ -1283,7 +1283,7 @@ free_specific(void *arg) {
 
 static void
 thread_key_mutex_init(void) {
-       RUNTIME_CHECK(isc_mutex_init(&thread_key_mutex) == ISC_R_SUCCESS);
+       isc_mutex_init(&thread_key_mutex);
 }
 
 static isc_result_t
index 9fb983f..882058d 100644 (file)
@@ -68,18 +68,13 @@ compare(const void *arg1, const void *arg2) {
 isc_result_t
 dns_portlist_create(isc_mem_t *mctx, dns_portlist_t **portlistp) {
        dns_portlist_t *portlist;
-       isc_result_t result;
 
        REQUIRE(portlistp != NULL && *portlistp == NULL);
 
        portlist = isc_mem_get(mctx, sizeof(*portlist));
        if (portlist == NULL)
                return (ISC_R_NOMEMORY);
-       result = isc_mutex_init(&portlist->lock);
-       if (result != ISC_R_SUCCESS) {
-               isc_mem_put(mctx, portlist, sizeof(*portlist));
-               return (result);
-       }
+       isc_mutex_init(&portlist->lock);
        isc_refcount_init(&portlist->refcount, 1);
        portlist->list = NULL;
        portlist->allocated = 0;
index be57554..eabbe5b 100644 (file)
@@ -34,7 +34,7 @@
 static isc_mutex_t wks_lock;
 
 static void init_lock(void) {
-       RUNTIME_CHECK(isc_mutex_init(&wks_lock) == ISC_R_SUCCESS);
+       isc_mutex_init(&wks_lock);
 }
 
 static bool
index d990290..df19ebc 100644 (file)
@@ -141,7 +141,6 @@ dns_requestmgr_create(isc_mem_t *mctx,
 {
        dns_requestmgr_t *requestmgr;
        isc_socket_t *sock;
-       isc_result_t result;
        int i;
        unsigned int dispattr;
 
@@ -166,20 +165,10 @@ dns_requestmgr_create(isc_mem_t *mctx,
        if (requestmgr == NULL)
                return (ISC_R_NOMEMORY);
 
-       result = isc_mutex_init(&requestmgr->lock);
-       if (result != ISC_R_SUCCESS) {
-               isc_mem_put(mctx, requestmgr, sizeof(*requestmgr));
-               return (result);
-       }
+       isc_mutex_init(&requestmgr->lock);
+
        for (i = 0; i < DNS_REQUEST_NLOCKS; i++) {
-               result = isc_mutex_init(&requestmgr->locks[i]);
-               if (result != ISC_R_SUCCESS) {
-                       while (--i >= 0)
-                               DESTROYLOCK(&requestmgr->locks[i]);
-                       DESTROYLOCK(&requestmgr->lock);
-                       isc_mem_put(mctx, requestmgr, sizeof(*requestmgr));
-                       return (result);
-               }
+               isc_mutex_init(&requestmgr->locks[i]);
        }
        requestmgr->timermgr = timermgr;
        requestmgr->socketmgr = socketmgr;
index 4ed282b..1d25f44 100644 (file)
@@ -9921,9 +9921,8 @@ dns_resolver_create(dns_view_t *view,
                goto cleanup_badcache;
        }
        for (i = 0; i < ntasks; i++) {
-               result = isc_mutex_init(&res->buckets[i].lock);
-               if (result != ISC_R_SUCCESS)
-                       goto cleanup_buckets;
+               isc_mutex_init(&res->buckets[i].lock);
+
                res->buckets[i].task = NULL;
                result = isc_task_create(taskmgr, 0, &res->buckets[i].task);
                if (result != ISC_R_SUCCESS) {
@@ -9960,11 +9959,7 @@ dns_resolver_create(dns_view_t *view,
                ISC_LIST_INIT(res->dbuckets[i].list);
                res->dbuckets[i].mctx = NULL;
                isc_mem_attach(view->mctx, &res->dbuckets[i].mctx);
-               result = isc_mutex_init(&res->dbuckets[i].lock);
-               if (result != ISC_R_SUCCESS) {
-                       isc_mem_detach(&res->dbuckets[i].mctx);
-                       goto cleanup_dbuckets;
-               }
+               isc_mutex_init(&res->dbuckets[i].lock);
                dbuckets_created++;
        }
 
@@ -9994,17 +9989,9 @@ dns_resolver_create(dns_view_t *view,
        res->primefetch = NULL;
        res->nfctx = 0;
 
-       result = isc_mutex_init(&res->lock);
-       if (result != ISC_R_SUCCESS)
-               goto cleanup_dispatches;
-
-       result = isc_mutex_init(&res->nlock);
-       if (result != ISC_R_SUCCESS)
-               goto cleanup_lock;
-
-       result = isc_mutex_init(&res->primelock);
-       if (result != ISC_R_SUCCESS)
-               goto cleanup_nlock;
+       isc_mutex_init(&res->lock);
+       isc_mutex_init(&res->nlock);
+       isc_mutex_init(&res->primelock);
 
        task = NULL;
        result = isc_task_create(taskmgr, 0, &task);
@@ -10052,20 +10039,14 @@ dns_resolver_create(dns_view_t *view,
 
  cleanup_primelock:
        DESTROYLOCK(&res->primelock);
-
- cleanup_nlock:
        DESTROYLOCK(&res->nlock);
-
- cleanup_lock:
        DESTROYLOCK(&res->lock);
 
- cleanup_dispatches:
        if (res->dispatches6 != NULL)
                dns_dispatchset_destroy(&res->dispatches6);
        if (res->dispatches4 != NULL)
                dns_dispatchset_destroy(&res->dispatches4);
 
- cleanup_dbuckets:
        for (i = 0; i < dbuckets_created; i++) {
                DESTROYLOCK(&res->dbuckets[i].lock);
                isc_mem_detach(&res->dbuckets[i].mctx);
index c8d5520..09b71ba 100644 (file)
@@ -1447,10 +1447,7 @@ dns_rpz_new_zones(dns_rpz_zones_t **rpzsp, char *rps_cstr,
        if (result != ISC_R_SUCCESS)
                goto cleanup_rwlock;
 
-       result = isc_mutex_init(&zones->maint_lock);
-       if (result != ISC_R_SUCCESS)
-               goto cleanup_mutex;
-
+       isc_mutex_init(&zones->maint_lock);
        isc_refcount_init(&zones->refs, 1);
 
        zones->rps_cstr = rps_cstr;
@@ -1490,7 +1487,6 @@ cleanup_rbt:
 
        DESTROYLOCK(&zones->maint_lock);
 
-cleanup_mutex:
        isc_rwlock_destroy(&zones->search_lock);
 
 cleanup_rwlock:
index 4b3ad7d..9a15bc8 100644 (file)
@@ -1296,11 +1296,7 @@ dns_rrl_init(dns_rrl_t **rrlp, dns_view_t *view, int min_entries) {
                return (ISC_R_NOMEMORY);
        memset(rrl, 0, sizeof(*rrl));
        isc_mem_attach(view->mctx, &rrl->mctx);
-       result = isc_mutex_init(&rrl->lock);
-       if (result != ISC_R_SUCCESS) {
-               isc_mem_putanddetach(&rrl->mctx, rrl, sizeof(*rrl));
-               return (result);
-       }
+       isc_mutex_init(&rrl->lock);
        isc_stdtime_get(&rrl->ts_bases[0]);
 
        view->rrl = rrl;
index e8331bf..fcde0e0 100644 (file)
@@ -226,9 +226,7 @@ dns_sdb_register(const char *drivername, const dns_sdbmethods_t *methods,
        imp->flags = flags;
        imp->mctx = NULL;
        isc_mem_attach(mctx, &imp->mctx);
-       result = isc_mutex_init(&imp->driverlock);
-       if (result != ISC_R_SUCCESS)
-               goto cleanup_mctx;
+       isc_mutex_init(&imp->driverlock);
 
        imp->dbimp = NULL;
        result = dns_db_register(drivername, dns_sdb_create, imp, mctx,
@@ -241,7 +239,6 @@ dns_sdb_register(const char *drivername, const dns_sdbmethods_t *methods,
 
  cleanup_mutex:
        DESTROYLOCK(&imp->driverlock);
- cleanup_mctx:
        isc_mem_put(mctx, imp, sizeof(dns_sdbimplementation_t));
        return (result);
 }
@@ -655,7 +652,6 @@ closeversion(dns_db_t *db, dns_dbversion_t **versionp, bool commit) {
 static isc_result_t
 createnode(dns_sdb_t *sdb, dns_sdbnode_t **nodep) {
        dns_sdbnode_t *node;
-       isc_result_t result;
 
        node = isc_mem_get(sdb->common.mctx, sizeof(dns_sdbnode_t));
        if (node == NULL)
@@ -667,11 +663,7 @@ createnode(dns_sdb_t *sdb, dns_sdbnode_t **nodep) {
        ISC_LIST_INIT(node->buffers);
        ISC_LINK_INIT(node, link);
        node->name = NULL;
-       result = isc_mutex_init(&node->lock);
-       if (result != ISC_R_SUCCESS) {
-               isc_mem_put(sdb->common.mctx, node, sizeof(dns_sdbnode_t));
-               return (result);
-       }
+       isc_mutex_init(&node->lock);
        dns_rdatacallbacks_init(&node->callbacks);
        node->references = 1;
        node->magic = SDBLOOKUP_MAGIC;
@@ -1333,9 +1325,7 @@ dns_sdb_create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type,
 
        isc_mem_attach(mctx, &sdb->common.mctx);
 
-       result = isc_mutex_init(&sdb->lock);
-       if (result != ISC_R_SUCCESS)
-               goto cleanup_mctx;
+       isc_mutex_init(&sdb->lock);
 
        result = dns_name_dupwithoffsets(origin, mctx, &sdb->common.origin);
        if (result != ISC_R_SUCCESS)
@@ -1378,7 +1368,6 @@ dns_sdb_create(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type,
        dns_name_free(&sdb->common.origin, mctx);
  cleanup_lock:
        (void)isc_mutex_destroy(&sdb->lock);
- cleanup_mctx:
        isc_mem_put(mctx, sdb, sizeof(dns_sdb_t));
        isc_mem_detach(&mctx);
 
index 015a358..405b149 100644 (file)
@@ -467,7 +467,6 @@ closeversion(dns_db_t *db, dns_dbversion_t **versionp, bool commit) {
 static isc_result_t
 createnode(dns_sdlz_db_t *sdlz, dns_sdlznode_t **nodep) {
        dns_sdlznode_t *node;
-       isc_result_t result;
 
        node = isc_mem_get(sdlz->common.mctx, sizeof(dns_sdlznode_t));
        if (node == NULL)
@@ -479,14 +478,7 @@ createnode(dns_sdlz_db_t *sdlz, dns_sdlznode_t **nodep) {
        ISC_LIST_INIT(node->buffers);
        ISC_LINK_INIT(node, link);
        node->name = NULL;
-       result = isc_mutex_init(&node->lock);
-       if (result != ISC_R_SUCCESS) {
-               UNEXPECTED_ERROR(__FILE__, __LINE__,
-                                "isc_mutex_init() failed: %s",
-                                isc_result_totext(result));
-               isc_mem_put(sdlz->common.mctx, node, sizeof(dns_sdlznode_t));
-               return (ISC_R_UNEXPECTED);
-       }
+       isc_mutex_init(&node->lock);
        dns_rdatacallbacks_init(&node->callbacks);
        node->references = 1;
        node->magic = SDLZLOOKUP_MAGIC;
@@ -1550,9 +1542,7 @@ dns_sdlzcreateDBP(isc_mem_t *mctx, void *driverarg, void *dbdata,
                goto mem_cleanup;
 
        /* initialize the reference count mutex */
-       result = isc_mutex_init(&sdlzdb->refcnt_lock);
-       if (result != ISC_R_SUCCESS)
-               goto name_cleanup;
+       isc_mutex_init(&sdlzdb->refcnt_lock);
 
        /* set the rest of the database structure attributes */
        sdlzdb->dlzimp = imp;
@@ -1572,13 +1562,6 @@ dns_sdlzcreateDBP(isc_mem_t *mctx, void *driverarg, void *dbdata,
        *dbp = (dns_db_t *) sdlzdb;
 
        return (result);
-
-       /*
-        * reference count mutex could not be initialized, clean up
-        * name memory
-        */
- name_cleanup:
-       dns_name_free(&sdlzdb->common.origin, mctx);
  mem_cleanup:
        isc_mem_put(mctx, sdlzdb, sizeof(dns_sdlz_db_t));
        return (result);
@@ -2096,13 +2079,7 @@ dns_sdlzregister(const char *drivername, const dns_sdlzmethods_t *methods,
         * initialize the driver lock, error if we cannot
         * (used if a driver does not support multiple threads)
         */
-       result = isc_mutex_init(&imp->driverlock);
-       if (result != ISC_R_SUCCESS) {
-               UNEXPECTED_ERROR(__FILE__, __LINE__,
-                                "isc_mutex_init() failed: %s",
-                                isc_result_totext(result));
-               goto cleanup_mctx;
-       }
+       isc_mutex_init(&imp->driverlock);
 
        imp->dlz_imp = NULL;
 
@@ -2127,7 +2104,6 @@ dns_sdlzregister(const char *drivername, const dns_sdlzmethods_t *methods,
        /* destroy the driver lock, we don't need it anymore */
        DESTROYLOCK(&imp->driverlock);
 
- cleanup_mctx:
        /*
         * return the memory back to the available memory pool and
         * remove it from the memory context.
index 908569d..7a6b530 100644 (file)
@@ -61,7 +61,6 @@ struct dns_ssutable {
 
 isc_result_t
 dns_ssutable_create(isc_mem_t *mctx, dns_ssutable_t **tablep) {
-       isc_result_t result;
        dns_ssutable_t *table;
 
        REQUIRE(tablep != NULL && *tablep == NULL);
@@ -70,11 +69,7 @@ dns_ssutable_create(isc_mem_t *mctx, dns_ssutable_t **tablep) {
        table = isc_mem_get(mctx, sizeof(dns_ssutable_t));
        if (table == NULL)
                return (ISC_R_NOMEMORY);
-       result = isc_mutex_init(&table->lock);
-       if (result != ISC_R_SUCCESS) {
-               isc_mem_put(mctx, table, sizeof(dns_ssutable_t));
-               return (result);
-       }
+       isc_mutex_init(&table->lock);
        table->references = 1;
        table->mctx = NULL;
        isc_mem_attach(mctx, &table->mctx);
index 617ed3b..4e63d42 100644 (file)
@@ -139,9 +139,7 @@ create_stats(isc_mem_t *mctx, dns_statstype_t type, int ncounters,
        stats->counters = NULL;
        stats->references = 1;
 
-       result = isc_mutex_init(&stats->lock);
-       if (result != ISC_R_SUCCESS)
-               goto clean_stats;
+       isc_mutex_init(&stats->lock);
 
        result = isc_stats_create(mctx, &stats->counters, ncounters);
        if (result != ISC_R_SUCCESS)
@@ -157,7 +155,6 @@ create_stats(isc_mem_t *mctx, dns_statstype_t type, int ncounters,
 
   clean_mutex:
        DESTROYLOCK(&stats->lock);
-  clean_stats:
        isc_mem_put(mctx, stats, sizeof(*stats));
 
        return (result);
index 68a9cd4..8bf338f 100644 (file)
@@ -268,8 +268,7 @@ dispatch_getnext(void **state) {
 
        UNUSED(state);
 
-       result = isc_mutex_init(&lock);
-       assert_int_equal(result, ISC_R_SUCCESS);
+       isc_mutex_init(&lock);
 
        result = isc_task_create(taskmgr, 0, &task);
        assert_int_equal(result, ISC_R_SUCCESS);
index b590abd..1354e0b 100644 (file)
@@ -3762,9 +3762,9 @@ dns_validator_create(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
        memset(event->proofs, 0, sizeof(event->proofs));
        event->optout = false;
        event->secure = false;
-       result = isc_mutex_init(&val->lock);
-       if (result != ISC_R_SUCCESS)
-               goto cleanup_event;
+
+       isc_mutex_init(&val->lock);
+
        val->event = event;
        val->options = options;
        val->attributes = 0;
@@ -3812,7 +3812,6 @@ dns_validator_create(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
  cleanup_mutex:
        DESTROYLOCK(&val->lock);
 
- cleanup_event:
        isc_task_detach(&tclone);
        isc_event_free(ISC_EVENT_PTR(&event));
 
index ecc4395..a568f62 100644 (file)
@@ -115,9 +115,7 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
                goto cleanup_name;
        }
 
-       result = isc_mutex_init(&view->lock);
-       if (result != ISC_R_SUCCESS)
-               goto cleanup_name;
+       isc_mutex_init(&view->lock);
 
        view->zonetable = NULL;
        result = dns_zt_create(mctx, rdclass, &view->zonetable);
@@ -261,10 +259,7 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
        view->dtenv = NULL;
        view->dttypes = 0;
 
-       result = isc_mutex_init(&view->new_zone_lock);
-       if (result != ISC_R_SUCCESS) {
-               goto cleanup_failcache;
-       }
+       isc_mutex_init(&view->new_zone_lock);
 
        result = dns_order_create(view->mctx, &view->order);
        if (result != ISC_R_SUCCESS) {
@@ -311,7 +306,6 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
  cleanup_new_zone_lock:
        DESTROYLOCK(&view->new_zone_lock);
 
- cleanup_failcache:
        dns_badcache_destroy(&view->failcache);
 
  cleanup_dynkeys:
index dbea599..5ac43fb 100644 (file)
@@ -900,10 +900,7 @@ dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx) {
        zone->mctx = NULL;
        isc_mem_attach(mctx, &zone->mctx);
 
-       result = isc_mutex_init(&zone->lock);
-       if (result != ISC_R_SUCCESS) {
-               goto free_zone;
-       }
+       isc_mutex_init(&zone->lock);
 
        result = ZONEDB_INITLOCK(&zone->dblock);
        if (result != ISC_R_SUCCESS) {
@@ -1093,7 +1090,6 @@ dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx) {
  free_mutex:
        DESTROYLOCK(&zone->lock);
 
- free_zone:
        isc_mem_putanddetach(&zone->mctx, zone, sizeof(*zone));
        return (result);
 }
@@ -16189,9 +16185,7 @@ dns_zonemgr_create(isc_mem_t *mctx, isc_taskmgr_t *taskmgr,
        ISC_LIST_INIT(zmgr->high);
        ISC_LIST_INIT(zmgr->low);
 
-       result = isc_mutex_init(&zmgr->iolock);
-       if (result != ISC_R_SUCCESS)
-               goto free_startuprefreshrl;
+       isc_mutex_init(&zmgr->iolock);
 
        zmgr->magic = ZONEMGR_MAGIC;
 
@@ -16202,8 +16196,6 @@ dns_zonemgr_create(isc_mem_t *mctx, isc_taskmgr_t *taskmgr,
  free_iolock:
        DESTROYLOCK(&zmgr->iolock);
 #endif
- free_startuprefreshrl:
-       isc_ratelimiter_detach(&zmgr->startuprefreshrl);
  free_startupnotifyrl:
        isc_ratelimiter_detach(&zmgr->startupnotifyrl);
  free_refreshrl:
index 0545006..1e56786 100644 (file)
@@ -135,7 +135,7 @@ free_specific_context(void *arg) {
 
 static void
 thread_key_mutex_init(void) {
-       RUNTIME_CHECK(isc_mutex_init(&thread_key_mutex) == ISC_R_SUCCESS);
+       isc_mutex_init(&thread_key_mutex);
 }
 
 static isc_result_t
index c2f7562..e78b926 100644 (file)
@@ -950,10 +950,7 @@ resolve_name(int family, const char *hostname, int flags,
        head.ai_port = port;
        head.actx = actx;
        head.dnsclient = client;
-       result = isc_mutex_init(&head.list_lock);
-       if (result != ISC_R_SUCCESS) {
-               return (EAI_FAIL);
-       }
+       isc_mutex_init(&head.list_lock);
 
        ISC_LIST_INIT(head.resstates);
        result = make_resstates(mctx, hostname, &head, conf);
index 8c70051..64defaa 100644 (file)
@@ -35,7 +35,6 @@ struct isc_counter {
 
 isc_result_t
 isc_counter_create(isc_mem_t *mctx, int limit, isc_counter_t **counterp) {
-       isc_result_t result;
        isc_counter_t *counter;
 
        REQUIRE(counterp != NULL && *counterp == NULL);
@@ -44,11 +43,7 @@ isc_counter_create(isc_mem_t *mctx, int limit, isc_counter_t **counterp) {
        if (counter == NULL)
                return (ISC_R_NOMEMORY);
 
-       result = isc_mutex_init(&counter->lock);
-       if (result != ISC_R_SUCCESS) {
-               isc_mem_put(mctx, counter, sizeof(*counter));
-               return (result);
-       }
+       isc_mutex_init(&counter->lock);
 
        counter->mctx = NULL;
        isc_mem_attach(mctx, &counter->mctx);
index 87a2187..2cdec11 100644 (file)
@@ -268,11 +268,7 @@ isc_httpdmgr_create(isc_mem_t *mctx, isc_socket_t *sock, isc_task_t *task,
        if (httpdmgr == NULL)
                return (ISC_R_NOMEMORY);
 
-       result = isc_mutex_init(&httpdmgr->lock);
-       if (result != ISC_R_SUCCESS) {
-               isc_mem_put(mctx, httpdmgr, sizeof(isc_httpdmgr_t));
-               return (result);
-       }
+       isc_mutex_init(&httpdmgr->lock);
        httpdmgr->mctx = NULL;
        isc_mem_attach(mctx, &httpdmgr->mctx);
        httpdmgr->sock = NULL;
index 210f302..6f8919d 100644 (file)
@@ -49,8 +49,8 @@
 
 #define ISC_QUEUE_INIT(queue, link) \
        do { \
-               (void) isc_mutex_init(&(queue).taillock); \
-               (void) isc_mutex_init(&(queue).headlock); \
+               isc_mutex_init(&(queue).taillock); \
+               isc_mutex_init(&(queue).headlock); \
                (queue).tail = (queue).head = NULL; \
        } while (0)
 
index b42d030..1626ffc 100644 (file)
@@ -277,11 +277,7 @@ isc_log_create(isc_mem_t *mctx, isc_log_t **lctxp, isc_logconfig_t **lcfgp) {
 
                ISC_LIST_INIT(lctx->messages);
 
-               result = isc_mutex_init(&lctx->lock);
-               if (result != ISC_R_SUCCESS) {
-                       isc_mem_putanddetach(&mctx, lctx, sizeof(*lctx));
-                       return (result);
-               }
+               isc_mutex_init(&lctx->lock);
 
                /*
                 * Normally setting the magic number is the last step done
index 5c449f3..2733f61 100644 (file)
@@ -751,7 +751,7 @@ default_memfree(void *arg, void *ptr) {
 
 static void
 initialize_action(void) {
-       RUNTIME_CHECK(isc_mutex_init(&contextslock) == ISC_R_SUCCESS);
+       isc_mutex_init(&contextslock);
        ISC_LIST_INIT(contexts);
        totallost = 0;
 }
@@ -783,11 +783,7 @@ isc_mem_createx(size_t init_max_size, size_t target_size,
        }
 
        if ((flags & ISC_MEMFLAG_NOLOCK) == 0) {
-               result = isc_mutex_init(&ctx->lock);
-               if (result != ISC_R_SUCCESS) {
-                       (memfree)(arg, ctx);
-                       return (result);
-               }
+               isc_mutex_init(&ctx->lock);
        }
 
        if (init_max_size == 0U)
index 6a629e7..9cbd470 100644 (file)
 
 isc_result_t
 isc_mutexblock_init(isc_mutex_t *block, unsigned int count) {
-       isc_result_t result;
        unsigned int i;
 
        for (i = 0; i < count; i++) {
-               result = isc_mutex_init(&block[i]);
-               if (result != ISC_R_SUCCESS) {
-                       while (i > 0U) {
-                               i--;
-                               DESTROYLOCK(&block[i]);
-                       }
-                       return (result);
-               }
+               isc_mutex_init(&block[i]);
        }
 
        return (ISC_R_SUCCESS);
index c405e61..aaddac5 100644 (file)
@@ -137,8 +137,8 @@ static void
 initialize(void) {
        char *pk11_provider;
 
-       RUNTIME_CHECK(isc_mutex_init(&alloclock) == ISC_R_SUCCESS);
-       RUNTIME_CHECK(isc_mutex_init(&sessionlock) == ISC_R_SUCCESS);
+       isc_mutex_init(&alloclock);
+       isc_mutex_init(&sessionlock);
 
        pk11_provider = getenv("PKCS11_PROVIDER");
        if (pk11_provider != NULL)
index 0ad9a0f..9cc04d0 100644 (file)
@@ -20,6 +20,7 @@
 #include <isc/mutex.h>
 #include <isc/result.h>
 #include <isc/strerr.h>
+#include <isc/string.h>
 #include <isc/types.h>
 
 typedef pthread_cond_t isc_condition_t;
index 6c34a69..ed9c7c7 100644 (file)
@@ -69,7 +69,7 @@ typedef pthread_mutex_t       isc_mutex_t;
 #else
 #define isc_mutex_init(mp) \
        isc__mutex_init((mp), __FILE__, __LINE__)
-isc_result_t isc__mutex_init(isc_mutex_t *mp, const char *file, unsigned int line);
+void isc__mutex_init(isc_mutex_t *mp, const char *file, unsigned int line);
 #endif
 #endif
 
@@ -119,7 +119,7 @@ isc_result_t isc__mutex_init(isc_mutex_t *mp, const char *file, unsigned int lin
 
 #if ISC_MUTEX_PROFILE
 
-isc_result_t
+void
 isc_mutex_init_profile(isc_mutex_t *mp, const char * _file, int _line);
 isc_result_t
 isc_mutex_lock_profile(isc_mutex_t *mp, const char * _file, int _line);
@@ -129,7 +129,7 @@ isc_mutex_unlock_profile(isc_mutex_t *mp, const char * _file, int _line);
 void
 isc_mutex_statsprofile(FILE *fp);
 
-isc_result_t
+void
 isc_mutex_init_errcheck(isc_mutex_t *mp);
 
 #endif /* ISC_MUTEX_PROFILE */
index b290b50..68b7824 100644 (file)
@@ -83,7 +83,7 @@ static bool stats_init = false;
 static pthread_mutex_t statslock = PTHREAD_MUTEX_INITIALIZER;
 
 
-isc_result_t
+void
 isc_mutex_init_profile(isc_mutex_t *mp, const char *file, int line) {
        int i, err;
 
@@ -123,8 +123,6 @@ isc_mutex_init_profile(isc_mutex_t *mp, const char *file, int line) {
                timevalclear(&mp->stats->lockers[i].locked_total);
                timevalclear(&mp->stats->lockers[i].wait_total);
        }
-
-       return (ISC_R_SUCCESS);
 }
 
 isc_result_t
@@ -235,7 +233,7 @@ initialize_errcheck(void) {
        errcheck_initialized = true;
 }
 
-isc_result_t
+void
 isc_mutex_init_errcheck(isc_mutex_t *mp) {
        isc_result_t result;
        int err;
@@ -244,9 +242,10 @@ isc_mutex_init_errcheck(isc_mutex_t *mp) {
        RUNTIME_CHECK(result == ISC_R_SUCCESS);
 
        err = pthread_mutex_init(mp, &errcheck);
-       if (err == ENOMEM)
-               return (ISC_R_NOMEMORY);
-       return ((err == 0) ? ISC_R_SUCCESS : ISC_R_UNEXPECTED);
+       if (err != 0) {
+               strerror_r(err, strbuf, sizeof(strbuf));
+               isc_error_fatal(file, line, "pthread_mutex_init failed: %s", strbuf);
+       }
 }
 #endif
 
@@ -275,13 +274,12 @@ initialize_attr(void) {
 }
 #endif /* HAVE_PTHREAD_MUTEX_ADAPTIVE_NP */
 
-isc_result_t
+void
 isc__mutex_init(isc_mutex_t *mp, const char *file, unsigned int line) {
-       char strbuf[ISC_STRERRORSIZE];
-       isc_result_t result = ISC_R_SUCCESS;
        int err;
 
 #ifdef HAVE_PTHREAD_MUTEX_ADAPTIVE_NP
+       isc_result_t result = ISC_R_SUCCESS;
        result = isc_once_do(&once_attr, initialize_attr);
        RUNTIME_CHECK(result == ISC_R_SUCCESS);
 
@@ -289,13 +287,10 @@ isc__mutex_init(isc_mutex_t *mp, const char *file, unsigned int line) {
 #else /* HAVE_PTHREAD_MUTEX_ADAPTIVE_NP */
        err = pthread_mutex_init(mp, ISC__MUTEX_ATTRS);
 #endif /* HAVE_PTHREAD_MUTEX_ADAPTIVE_NP */
-
-       if (err == ENOMEM)
-               return (ISC_R_NOMEMORY);
        if (err != 0) {
+               char strbuf[ISC_STRERRORSIZE];
                strerror_r(err, strbuf, sizeof(strbuf));
                isc_error_fatal(file, line, "pthread_mutex_init failed: %s", strbuf);
        }
-       return (result);
 }
 #endif
index 3ddff0d..1f4c5fb 100644 (file)
@@ -24,7 +24,9 @@ isc_quota_init(isc_quota_t *quota, int max) {
        quota->max = max;
        quota->used = 0;
        quota->soft = 0;
-       return (isc_mutex_init(&quota->lock));
+       isc_mutex_init(&quota->lock);
+       /* XXXOND: Todo make return void */
+       return (ISC_R_SUCCESS);
 }
 
 void
index 180d72f..e59301c 100644 (file)
@@ -74,9 +74,7 @@ isc_ratelimiter_create(isc_mem_t *mctx, isc_timermgr_t *timermgr,
        rl->state = isc_ratelimiter_idle;
        ISC_LIST_INIT(rl->pending);
 
-       result = isc_mutex_init(&rl->lock);
-       if (result != ISC_R_SUCCESS)
-               goto free_mem;
+       isc_mutex_init(&rl->lock);
 
        result = isc_timer_create(timermgr, isc_timertype_inactive,
                                  NULL, NULL, rl->task, ratelimiter_tick,
@@ -100,7 +98,6 @@ isc_ratelimiter_create(isc_mem_t *mctx, isc_timermgr_t *timermgr,
 
 free_mutex:
        DESTROYLOCK(&rl->lock);
-free_mem:
        isc_mem_put(mctx, rl, sizeof(*rl));
        return (result);
 }
index 4920a98..417533d 100644 (file)
@@ -218,7 +218,7 @@ static void
 initialize_action(void) {
        isc_result_t result;
 
-       RUNTIME_CHECK(isc_mutex_init(&lock) == ISC_R_SUCCESS);
+       isc_mutex_init(&lock);
        ISC_LIST_INIT(description_tables);
        ISC_LIST_INIT(identifier_tables);
 
index d959506..c4e87ed 100644 (file)
@@ -94,8 +94,6 @@ isc_result_t
 isc_rwlock_init(isc_rwlock_t *rwl, unsigned int read_quota,
                unsigned int write_quota)
 {
-       isc_result_t result;
-
        REQUIRE(rwl != NULL);
 
        /*
@@ -118,9 +116,7 @@ isc_rwlock_init(isc_rwlock_t *rwl, unsigned int read_quota,
                write_quota = RWLOCK_DEFAULT_WRITE_QUOTA;
        rwl->write_quota = write_quota;
 
-       result = isc_mutex_init(&rwl->lock);
-       if (result != ISC_R_SUCCESS)
-               return (result);
+       isc_mutex_init(&rwl->lock);
 
        isc_condition_init(&rwl->readable);
        isc_condition_init(&rwl->writeable);
index 3a09aaa..9fec283 100644 (file)
@@ -72,9 +72,7 @@ create_stats(isc_mem_t *mctx, int ncounters, isc_stats_t **statsp) {
        if (stats == NULL)
                return (ISC_R_NOMEMORY);
 
-       result = isc_mutex_init(&stats->lock);
-       if (result != ISC_R_SUCCESS)
-               goto clean_stats;
+       isc_mutex_init(&stats->lock);
 
        stats->counters = isc_mem_get(mctx, sizeof(isc_stat_t) * ncounters);
        if (stats->counters == NULL) {
@@ -104,8 +102,6 @@ clean_counters:
 
 clean_mutex:
        DESTROYLOCK(&stats->lock);
-
-clean_stats:
        isc_mem_put(mctx, stats, sizeof(*stats));
 
        return (result);
index 93cdac3..5808054 100644 (file)
@@ -248,7 +248,6 @@ isc_task_create(isc_taskmgr_t *manager0, unsigned int quantum,
        isc__taskmgr_t *manager = (isc__taskmgr_t *)manager0;
        isc__task_t *task;
        bool exiting;
-       isc_result_t result;
 
        REQUIRE(VALID_MANAGER(manager));
        REQUIRE(taskp != NULL && *taskp == NULL);
@@ -261,11 +260,8 @@ isc_task_create(isc_taskmgr_t *manager0, unsigned int quantum,
        task->threadid = atomic_fetch_add_explicit(&manager->curq, 1,
                                                   memory_order_relaxed)
                                                   % manager->workers;
-       result = isc_mutex_init(&task->lock);
-       if (result != ISC_R_SUCCESS) {
-               isc_mem_put(manager->mctx, task, sizeof(*task));
-               return (result);
-       }
+       isc_mutex_init(&task->lock);
+
        task->state = task_state_idle;
        task->references = 1;
        INIT_LIST(task->events);
@@ -1336,10 +1332,10 @@ isc_taskmgr_create(isc_mem_t *mctx, unsigned int workers,
        manager->common.magic = ISCAPI_TASKMGR_MAGIC;
        manager->mode = isc_taskmgrmode_normal;
        manager->mctx = NULL;
-       RUNTIME_CHECK(isc_mutex_init(&manager->lock) == ISC_R_SUCCESS);
-       RUNTIME_CHECK(isc_mutex_init(&manager->excl_lock) == ISC_R_SUCCESS);
+       isc_mutex_init(&manager->lock);
+       isc_mutex_init(&manager->excl_lock);
 
-       RUNTIME_CHECK(isc_mutex_init(&manager->halt_lock) == ISC_R_SUCCESS);
+       isc_mutex_init(&manager->halt_lock);
        isc_condition_init(&manager->halt_cond);
 
        manager->workers = workers;
@@ -1370,8 +1366,7 @@ isc_taskmgr_create(isc_mem_t *mctx, unsigned int workers,
        for (i = 0; i < workers; i++) {
                INIT_LIST(manager->queues[i].ready_tasks);
                INIT_LIST(manager->queues[i].ready_priority_tasks);
-               RUNTIME_CHECK(isc_mutex_init(&manager->queues[i].lock)
-                             == ISC_R_SUCCESS);
+               isc_mutex_init(&manager->queues[i].lock);
                isc_condition_init(&manager->queues[i].work_available);
 
                manager->queues[i].manager = manager;
index c9c1d51..18c1717 100644 (file)
@@ -56,8 +56,7 @@ _setup(void **state) {
 
        UNUSED(state);
 
-       result = isc_mutex_init(&lock);
-       assert_int_equal(result, ISC_R_SUCCESS);
+       isc_mutex_init(&lock);
 
        isc_condition_init(&cv);
 
@@ -73,8 +72,7 @@ _setup2(void **state) {
 
        UNUSED(state);
 
-       result = isc_mutex_init(&lock);
-       assert_int_equal(result, ISC_R_SUCCESS);
+       isc_mutex_init(&lock);
 
        isc_condition_init(&cv);
 
@@ -91,8 +89,7 @@ _setup4(void **state) {
 
        UNUSED(state);
 
-       result = isc_mutex_init(&lock);
-       assert_int_equal(result, ISC_R_SUCCESS);
+       isc_mutex_init(&lock);
 
        isc_condition_init(&cv);
 
index 1ef1577..7df08db 100644 (file)
@@ -105,8 +105,7 @@ setup_test(isc_timertype_t timertype, isc_time_t *expires,
        isc_time_settoepoch(&endtime);
        eventcnt = 0;
 
-       result = isc_mutex_init(&mx);
-       assert_int_equal(result, ISC_R_SUCCESS);
+       isc_mutex_init(&mx);
 
        isc_condition_init(&cv);
 
@@ -502,8 +501,7 @@ purge(void **state) {
        seconds = 1;
        nanoseconds = 0;
 
-       result = isc_mutex_init(&mx);
-       assert_int_equal(result, ISC_R_SUCCESS);
+       isc_mutex_init(&mx);
 
        isc_condition_init(&cv);
 
index 96b3d42..540bf28 100644 (file)
@@ -321,12 +321,7 @@ isc_timer_create(isc_timermgr_t *manager0, isc_timertype_t type,
         */
        DE_CONST(arg, timer->arg);
        timer->index = 0;
-       result = isc_mutex_init(&timer->lock);
-       if (result != ISC_R_SUCCESS) {
-               isc_task_detach(&timer->task);
-               isc_mem_put(manager->mctx, timer, sizeof(*timer));
-               return (result);
-       }
+       isc_mutex_init(&timer->lock);
        ISC_LINK_INIT(timer, link);
        timer->common.impmagic = TIMER_MAGIC;
        timer->common.magic = ISCAPI_TIMER_MAGIC;
@@ -743,12 +738,7 @@ isc_timermgr_create(isc_mem_t *mctx, isc_timermgr_t **managerp) {
                isc_mem_put(mctx, manager, sizeof(*manager));
                return (ISC_R_NOMEMORY);
        }
-       result = isc_mutex_init(&manager->lock);
-       if (result != ISC_R_SUCCESS) {
-               isc_heap_destroy(&manager->heap);
-               isc_mem_put(mctx, manager, sizeof(*manager));
-               return (result);
-       }
+       isc_mutex_init(&manager->lock);
        isc_mem_attach(mctx, &manager->mctx);
        isc_condition_init(&manager->wakeup);
        if (isc_thread_create(run, manager, &manager->thread) !=
index 8027f59..983ce9f 100644 (file)
@@ -138,15 +138,11 @@ isc_app_ctxstart(isc_appctx_t *ctx0) {
         * Start an ISC library application.
         */
 
-       result = isc_mutex_init(&ctx->readylock);
-       if (result != ISC_R_SUCCESS)
-               return (result);
+       isc_mutex_init(&ctx->readylock);
 
        isc_condition_init(&ctx->ready);
 
-       result = isc_mutex_init(&ctx->lock);
-       if (result != ISC_R_SUCCESS)
-               goto cleanup;
+       isc_mutex_init(&ctx->lock);
 
        ISC_LIST_INIT(ctx->on_run);
 
index 9b29cde..f667d49 100644 (file)
@@ -1935,7 +1935,7 @@ allocate_socket(isc__socketmgr_t *manager, isc_sockettype_t type,
        /*
         * Initialize the lock.
         */
-       RUNTIME_CHECK(isc_mutex_init(&sock->lock) == ISC_R_SUCCESS);
+       isc_mutex_init(&sock->lock);
 
        sock->common.magic = ISCAPI_SOCKET_MAGIC;
        sock->common.impmagic = SOCKET_MAGIC;
@@ -3682,10 +3682,7 @@ setup_thread(isc__socketthread_t *thread) {
                                     FDLOCK_COUNT * sizeof(isc_mutex_t));
 
        for (i = 0; i < FDLOCK_COUNT; i++) {
-               result = isc_mutex_init(&thread->fdlock[i]);
-               if (result != ISC_R_SUCCESS) {
-                       return (result);
-               }
+               isc_mutex_init(&thread->fdlock[i]);
        }
 
        if (pipe(thread->pipe_fds) != 0) {
@@ -3932,8 +3929,7 @@ isc_socketmgr_create2(isc_mem_t *mctx, isc_socketmgr_t **managerp,
        manager->common.impmagic = SOCKET_MANAGER_MAGIC;
        manager->mctx = NULL;
        ISC_LIST_INIT(manager->socklist);
-       RUNTIME_CHECK(isc_mutex_init(&manager->lock) == ISC_R_SUCCESS);
-
+       isc_mutex_init(&manager->lock);
        isc_condition_init(&manager->shutdown_ok);
 
        /*
index ae4c015..e3d4c7b 100644 (file)
@@ -99,9 +99,7 @@ isc_app_ctxstart(isc_appctx_t *ctx0) {
 
        main_thread = GetCurrentThread();
 
-       result = isc_mutex_init(&ctx->lock);
-       if (result != ISC_R_SUCCESS)
-               return (result);
+       isc_mutex_init(&ctx->lock);
 
        ctx->shutdown_requested = false;
        ctx->running = false;
index 6815741..1d49430 100644 (file)
@@ -30,7 +30,7 @@ TryEnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection);
 #endif /* _WIN32_WINNT < 0x0400 */
 
 #define isc_mutex_init(mp) \
-       (InitializeCriticalSection((mp)), ISC_R_SUCCESS)
+       InitializeCriticalSection((mp))
 #define isc_mutex_lock(mp) \
        (EnterCriticalSection((mp)), ISC_R_SUCCESS)
 #define isc_mutex_unlock(mp) \
index 4bd9b87..761a1d2 100644 (file)
@@ -1385,9 +1385,7 @@ allocate_socket(isc_socketmgr_t *manager, isc_sockettype_t type,
        /*
         * Initialize the lock.
         */
-       result = isc_mutex_init(&sock->lock);
-       if (result != ISC_R_SUCCESS)
-               goto error;
+       isc_mutex_init(&sock->lock);
 
        socket_log(__LINE__, sock, NULL, EVENT, NULL, 0, 0,
                   "allocated");
@@ -2556,11 +2554,7 @@ isc_socketmgr_create2(isc_mem_t *mctx, isc_socketmgr_t **managerp,
        manager->mctx = NULL;
        manager->stats = NULL;
        ISC_LIST_INIT(manager->socklist);
-       result = isc_mutex_init(&manager->lock);
-       if (result != ISC_R_SUCCESS) {
-               isc_mem_put(mctx, manager, sizeof(*manager));
-               return (result);
-       }
+       isc_mutex_init(&manager->lock);
        isc_condition_init(&manager->shutdown_ok);
 
        isc_mem_attach(mctx, &manager->mctx);
index 60929a8..83d6342 100644 (file)
@@ -3421,17 +3421,9 @@ ns_clientmgr_create(isc_mem_t *mctx, ns_server_t *sctx, isc_taskmgr_t *taskmgr,
        if (manager == NULL)
                return (ISC_R_NOMEMORY);
 
-       result = isc_mutex_init(&manager->lock);
-       if (result != ISC_R_SUCCESS)
-               goto cleanup_manager;
-
-       result = isc_mutex_init(&manager->listlock);
-       if (result != ISC_R_SUCCESS)
-               goto cleanup_lock;
-
-       result = isc_mutex_init(&manager->reclock);
-       if (result != ISC_R_SUCCESS)
-               goto cleanup_listlock;
+       isc_mutex_init(&manager->lock);
+       isc_mutex_init(&manager->listlock);
+       isc_mutex_init(&manager->reclock);
 
        manager->excl = NULL;
        result = isc_taskmgr_excltask(taskmgr, &manager->excl);
@@ -3465,14 +3457,9 @@ ns_clientmgr_create(isc_mem_t *mctx, ns_server_t *sctx, isc_taskmgr_t *taskmgr,
 
  cleanup_reclock:
        (void) isc_mutex_destroy(&manager->reclock);
-
- cleanup_listlock:
        (void) isc_mutex_destroy(&manager->listlock);
-
- cleanup_lock:
        (void) isc_mutex_destroy(&manager->lock);
 
- cleanup_manager:
        isc_mem_put(manager->mctx, manager, sizeof(*manager));
 
        return (result);
index adba622..ae539c2 100644 (file)
@@ -201,9 +201,7 @@ ns_interfacemgr_create(isc_mem_t *mctx,
        mgr->sctx = NULL;
        ns_server_attach(sctx, &mgr->sctx);
 
-       result = isc_mutex_init(&mgr->lock);
-       if (result != ISC_R_SUCCESS)
-               goto cleanup_ctx;
+       isc_mutex_init(&mgr->lock);
 
        mgr->excl = NULL;
        result = isc_taskmgr_excltask(taskmgr, &mgr->excl);
@@ -404,9 +402,7 @@ ns_interface_create(ns_interfacemgr_t *mgr, isc_sockaddr_t *addr,
        strlcpy(ifp->name, name, sizeof(ifp->name));
        ifp->clientmgr = NULL;
 
-       result = isc_mutex_init(&ifp->lock);
-       if (result != ISC_R_SUCCESS)
-               goto lock_create_failure;
+       isc_mutex_init(&ifp->lock);
 
        result = ns_clientmgr_create(mgr->mctx, mgr->sctx,
                                     mgr->taskmgr, mgr->timermgr,
@@ -449,7 +445,6 @@ ns_interface_create(ns_interfacemgr_t *mgr, isc_sockaddr_t *addr,
  clientmgr_create_failure:
        DESTROYLOCK(&ifp->lock);
 
- lock_create_failure:
        ifp->magic = 0;
        isc_mem_put(mgr->mctx, ifp, sizeof(*ifp));
 
index 7aebe53..6c41521 100644 (file)
@@ -54,16 +54,10 @@ initialize(void) {
        if (result != ISC_R_SUCCESS)
                return;
 
-       result = isc_mutex_init(&reflock);
-       if (result != ISC_R_SUCCESS)
-               goto cleanup_mctx;
+       isc_mutex_init(&reflock);
 
        initialize_done = true;
        return;
-
-  cleanup_mctx:
-       if (ns_g_mctx != NULL)
-               isc_mem_detach(&ns_g_mctx);
 }
 
 isc_result_t
index 35ffc09..b649254 100644 (file)
@@ -923,9 +923,8 @@ ns_query_init(ns_client_t *client) {
         * This mutex is destroyed when the client is destroyed in
         * exit_check().
         */
-       result = isc_mutex_init(&client->query.fetchlock);
-       if (result != ISC_R_SUCCESS)
-               return (result);
+       isc_mutex_init(&client->query.fetchlock);
+
        client->query.fetch = NULL;
        client->query.prefetch = NULL;
        client->query.authdb = NULL;
index d1fa7fe..0555fc3 100644 (file)
@@ -80,9 +80,7 @@ ns_stats_create(isc_mem_t *mctx, int ncounters, ns_stats_t **statsp) {
        stats->counters = NULL;
        stats->references = 1;
 
-       result = isc_mutex_init(&stats->lock);
-       if (result != ISC_R_SUCCESS)
-               goto clean_stats;
+       isc_mutex_init(&stats->lock);
 
        result = isc_stats_create(mctx, &stats->counters, ncounters);
        if (result != ISC_R_SUCCESS)
@@ -97,7 +95,6 @@ ns_stats_create(isc_mem_t *mctx, int ncounters, ns_stats_t **statsp) {
 
   clean_mutex:
        DESTROYLOCK(&stats->lock);
-  clean_stats:
        isc_mem_put(mctx, stats, sizeof(*stats));
 
        return (result);