The isc_mempool_create() function now cannot fail with ISC_R_MEMORY.
This commit removes all the checks on the return code using the semantic
patch from previous commit, as isc_mempool_create() now returns void.
check_result(result, "dst_lib_init");
is_dst_up = true;
- result = isc_mempool_create(mctx, COMMSIZE, &commctx);
- check_result(result, "isc_mempool_create");
+ isc_mempool_create(mctx, COMMSIZE, &commctx);
isc_mempool_setname(commctx, "COMMPOOL");
/*
* 6 and 2 set as reasonable parameters for 3 or 4 nameserver
cfg_line, mctx, lctx, actx));
}
- CHECK(isc_mempool_create(mctx, sizeof(filter_data_t),
- &inst->datapool));
+ isc_mempool_create(mctx, sizeof(filter_data_t),
+ &inst->datapool);
CHECK(isc_ht_init(&inst->ht, mctx, 16));
isc_mutex_init(&inst->hlock);
isc_mem_create(&mctx);
cmp = NULL;
- RUNTIME_CHECK(isc_mempool_create(mctx, sizeof(client_t), &cmp)
- == ISC_R_SUCCESS);
+ isc_mempool_create(mctx, sizeof(client_t), &cmp)
+ ;
isc_mempool_setname(cmp, "adb test clients");
result = isc_log_create(mctx, &lctx, &lcfg);
isc_mem_create(&mctx);
mp1 = NULL;
- RUNTIME_CHECK(isc_mempool_create(mctx, 24, &mp1) == ISC_R_SUCCESS);
+ isc_mempool_create(mctx, 24, &mp1);
mp2 = NULL;
- RUNTIME_CHECK(isc_mempool_create(mctx, 31, &mp2) == ISC_R_SUCCESS);
+ isc_mempool_create(mctx, 31, &mp2);
isc_mempool_associatelock(mp1, &lock);
isc_mempool_associatelock(mp2, &lock);
* Memory pools
*/
#define MPINIT(t, p, n) do { \
- result = isc_mempool_create(mem, sizeof(t), &(p)); \
- if (result != ISC_R_SUCCESS) \
- goto fail2; \
+ isc_mempool_create(mem, sizeof(t), &(p)); \
isc_mempool_setfreemax((p), FREE_ITEMS); \
isc_mempool_setfillcount((p), FILL_COUNT); \
isc_mempool_setname((p), n); \
isc_mutex_init(&mgr->spool_lock);
mgr->depool = NULL;
- if (isc_mempool_create(mgr->mctx, sizeof(dns_dispatchevent_t),
- &mgr->depool) != ISC_R_SUCCESS) {
- result = ISC_R_NOMEMORY;
- goto kill_locks;
- }
+ isc_mempool_create(mgr->mctx, sizeof(dns_dispatchevent_t),
+ &mgr->depool);
mgr->rpool = NULL;
- if (isc_mempool_create(mgr->mctx, sizeof(dns_dispentry_t),
- &mgr->rpool) != ISC_R_SUCCESS) {
- result = ISC_R_NOMEMORY;
- goto kill_depool;
- }
+ isc_mempool_create(mgr->mctx, sizeof(dns_dispentry_t),
+ &mgr->rpool);
mgr->dpool = NULL;
- if (isc_mempool_create(mgr->mctx, sizeof(dns_dispatch_t),
- &mgr->dpool) != ISC_R_SUCCESS) {
- result = ISC_R_NOMEMORY;
- goto kill_rpool;
- }
+ isc_mempool_create(mgr->mctx, sizeof(dns_dispatch_t),
+ &mgr->dpool);
isc_mempool_setname(mgr->depool, "dispmgr_depool");
isc_mempool_setmaxalloc(mgr->depool, 32768);
kill_dpool:
isc_mempool_destroy(&mgr->dpool);
- kill_rpool:
isc_mempool_destroy(&mgr->rpool);
- kill_depool:
isc_mempool_destroy(&mgr->depool);
- kill_locks:
isc_mutex_destroy(&mgr->spool_lock);
isc_mutex_destroy(&mgr->bpool_lock);
isc_mutex_destroy(&mgr->dpool_lock);
mgr->maxbuffers = maxbuffers;
}
} else {
- result = isc_mempool_create(mgr->mctx, buffersize, &mgr->bpool);
- if (result != ISC_R_SUCCESS) {
- UNLOCK(&mgr->buffer_lock);
- return (result);
- }
+ isc_mempool_create(mgr->mctx, buffersize, &mgr->bpool);
isc_mempool_setname(mgr->bpool, "dispmgr_bpool");
isc_mempool_setmaxalloc(mgr->bpool, maxbuffers);
isc_mempool_setfreemax(mgr->bpool, maxbuffers);
UNLOCK(&mgr->buffer_lock);
return (ISC_R_SUCCESS);
}
- result = isc_mempool_create(mgr->mctx, sizeof(dispsocket_t),
+ isc_mempool_create(mgr->mctx, sizeof(dispsocket_t),
&mgr->spool);
- if (result != ISC_R_SUCCESS)
- goto cleanup;
isc_mempool_setname(mgr->spool, "dispmgr_spool");
isc_mempool_setmaxalloc(mgr->spool, maxrequests);
ISC_LIST_INIT(disp->port_table[i]);
}
- result = isc_mempool_create(mgr->mctx, sizeof(dispportentry_t),
+ isc_mempool_create(mgr->mctx, sizeof(dispportentry_t),
&disp->portpool);
- if (result != ISC_R_SUCCESS) {
- goto deallocate_dispatch;
- }
isc_mempool_setname(disp->portpool, "disp_portpool");
isc_mempool_setfreemax(disp->portpool, 128);
}
sizeof(isc_event_t));
disp->sepool = NULL;
- if (isc_mempool_create(mgr->mctx, sizeof(isc_socketevent_t),
- &disp->sepool) != ISC_R_SUCCESS)
- {
- result = ISC_R_NOMEMORY;
- goto kill_ctlevent;
- }
+ isc_mempool_create(mgr->mctx, sizeof(isc_socketevent_t),
+ &disp->sepool);
isc_mutex_init(&disp->sepool_lock);
/*
* Error returns.
*/
- kill_ctlevent:
- isc_event_free(&disp->ctlevent);
- for (i = 0; i < disp->ntasks; i++) {
- isc_task_detach(&disp->task[i]);
- }
kill_socket:
if (disp->socket != NULL) {
isc_socket_detach(&disp->socket);
* Ok, it is safe to allocate (and then "goto cleanup" if failure)
*/
- result = isc_mempool_create(m->mctx, sizeof(dns_name_t), &m->namepool);
- if (result != ISC_R_SUCCESS)
- goto cleanup;
+ isc_mempool_create(m->mctx, sizeof(dns_name_t), &m->namepool);
isc_mempool_setfillcount(m->namepool, NAME_COUNT);
isc_mempool_setfreemax(m->namepool, NAME_COUNT);
isc_mempool_setname(m->namepool, "msg:names");
- result = isc_mempool_create(m->mctx, sizeof(dns_rdataset_t),
+ isc_mempool_create(m->mctx, sizeof(dns_rdataset_t),
&m->rdspool);
- if (result != ISC_R_SUCCESS)
- goto cleanup;
isc_mempool_setfillcount(m->rdspool, RDATASET_COUNT);
isc_mempool_setfreemax(m->rdspool, RDATASET_COUNT);
isc_mempool_setname(m->rdspool, "msg:rdataset");
/* general memory system tests */
static void
isc_mem_test(void **state) {
- isc_result_t result;
void *items1[50];
void *items2[50];
void *tmp;
UNUSED(state);
- result = isc_mempool_create(test_mctx, 24, &mp1);
- assert_int_equal(result, ISC_R_SUCCESS);
-
- result = isc_mempool_create(test_mctx, 31, &mp2);
- assert_int_equal(result, ISC_R_SUCCESS);
+ isc_mempool_create(test_mctx, 24, &mp1);
+ isc_mempool_create(test_mctx, 31, &mp2);
isc_mempool_setfreemax(mp1, MP1_FREEMAX);
isc_mempool_setfillcount(mp1, MP1_FILLCNT);
isc_mempool_destroy(&mp1);
isc_mempool_destroy(&mp2);
- result = isc_mempool_create(test_mctx, 2, &mp1);
- assert_int_equal(result, ISC_R_SUCCESS);
+ isc_mempool_create(test_mctx, 2, &mp1);
tmp = isc_mempool_get(mp1);
assert_non_null(tmp);
isc_mutex_init(&mplock);
- result = isc_mempool_create(test_mctx, ITEM_SIZE, &mp);
- assert_int_equal(result, ISC_R_SUCCESS);
+ isc_mempool_create(test_mctx, ITEM_SIZE, &mp);
isc_mempool_associatelock(mp, &mplock);