Compare commits

...
90 changed files with 301 additions and 983 deletions
+1 -1
View File
@@ -129,7 +129,7 @@ add(char *key, int value) {
isc_symvalue_t symvalue; isc_symvalue_t symvalue;
if (sym_mctx == NULL) { if (sym_mctx == NULL) {
result = isc_mem_create(0, 0, &sym_mctx); result = isc_mem_create(&sym_mctx);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
return; return;
} }
+1 -1
View File
@@ -583,7 +583,7 @@ main(int argc, char **argv) {
} }
isc_commandline_reset = true; isc_commandline_reset = true;
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
while ((c = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != EOF) { while ((c = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != EOF) {
switch (c) { switch (c) {
+1 -1
View File
@@ -519,7 +519,7 @@ main(int argc, char **argv) {
InitSockets(); InitSockets();
#endif #endif
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
if (!quiet) if (!quiet)
RUNTIME_CHECK(setup_logging(mctx, errout, &lctx) RUNTIME_CHECK(setup_logging(mctx, errout, &lctx)
== ISC_R_SUCCESS); == ISC_R_SUCCESS);
+1 -1
View File
@@ -209,7 +209,7 @@ main(int argc, char **argv) {
/* Use canonical algorithm name */ /* Use canonical algorithm name */
algname = alg_totext(alg); algname = alg_totext(alg);
DO("create memory context", isc_mem_create(0, 0, &mctx)); DO("create memory context", isc_mem_create(&mctx));
if (keyname == NULL) { if (keyname == NULL) {
const char *suffix = NULL; const char *suffix = NULL;
+1 -1
View File
@@ -211,7 +211,7 @@ main(int argc, char **argv) {
keysize = alg_bits(alg); keysize = alg_bits(alg);
algname = alg_totext(alg); algname = alg_totext(alg);
DO("create memory context", isc_mem_create(0, 0, &mctx)); DO("create memory context", isc_mem_create(&mctx));
isc_buffer_init(&key_txtbuffer, &key_txtsecret, sizeof(key_txtsecret)); isc_buffer_init(&key_txtbuffer, &key_txtsecret, sizeof(key_txtsecret));
generate_key(mctx, alg, keysize, &key_txtbuffer); generate_key(mctx, alg, keysize, &key_txtbuffer);
+1 -1
View File
@@ -1586,7 +1586,7 @@ main(int argc, char *argv[]) {
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
fatal("dns_lib_init failed: %d", result); fatal("dns_lib_init failed: %d", result);
result = isc_mem_create(0, 0, &mctx); result = isc_mem_create(&mctx);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
fatal("failed to create mctx"); fatal("failed to create mctx");
+1 -1
View File
@@ -1324,7 +1324,7 @@ setup_libs(void) {
if (!have_ipv6 && !have_ipv4) if (!have_ipv6 && !have_ipv4)
fatal("can't find either v4 or v6 networking"); fatal("can't find either v4 or v6 networking");
result = isc_mem_create(0, 0, &mctx); result = isc_mem_create(&mctx);
check_result(result, "isc_mem_create"); check_result(result, "isc_mem_create");
isc_mem_setname(mctx, "dig", NULL); isc_mem_setname(mctx, "dig", NULL);
+1 -1
View File
@@ -1144,7 +1144,7 @@ main(int argc, char *argv[]) {
int ch; int ch;
char *endp; char *endp;
result = isc_mem_create(0, 0, &mctx); result = isc_mem_create(&mctx);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
fatal("out of memory"); fatal("out of memory");
} }
+1 -1
View File
@@ -368,7 +368,7 @@ main(int argc, char **argv) {
if (argc == 1) if (argc == 1)
usage(); usage();
result = isc_mem_create(0, 0, &mctx); result = isc_mem_create(&mctx);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
fatal("out of memory"); fatal("out of memory");
+1 -1
View File
@@ -307,7 +307,7 @@ main(int argc, char **argv) {
if (argc == 1) if (argc == 1)
usage(); usage();
result = isc_mem_create(0, 0, &mctx); result = isc_mem_create(&mctx);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
fatal("out of memory"); fatal("out of memory");
+1 -1
View File
@@ -166,7 +166,7 @@ main(int argc, char **argv) {
if (argc == 1) if (argc == 1)
usage(); usage();
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
#if USE_PKCS11 #if USE_PKCS11
pk11_result_register(); pk11_result_register();
+1 -1
View File
@@ -265,7 +265,7 @@ main(int argc, char **argv) {
} }
isc_commandline_reset = true; isc_commandline_reset = true;
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
isc_stdtime_get(&now); isc_stdtime_get(&now);
+1 -1
View File
@@ -91,7 +91,7 @@ main(int argc, char **argv) {
if (argc == 1) if (argc == 1)
usage(); usage();
result = isc_mem_create(0, 0, &mctx); result = isc_mem_create(&mctx);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
fatal("Out of memory"); fatal("Out of memory");
+1 -1
View File
@@ -170,7 +170,7 @@ main(int argc, char **argv) {
if (argc == 1) if (argc == 1)
usage(); usage();
result = isc_mem_create(0, 0, &mctx); result = isc_mem_create(&mctx);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
fatal("Out of memory"); fatal("Out of memory");
+1 -1
View File
@@ -3278,7 +3278,7 @@ main(int argc, char *argv[]) {
check_result(isc_app_start(), "isc_app_start"); check_result(isc_app_start(), "isc_app_start");
result = isc_mem_create(0, 0, &mctx); result = isc_mem_create(&mctx);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
fatal("out of memory"); fatal("out of memory");
+1 -1
View File
@@ -201,7 +201,7 @@ main(int argc, char *argv[]) {
isc_commandline_reset = true; isc_commandline_reset = true;
check_result(isc_app_start(), "isc_app_start"); check_result(isc_app_start(), "isc_app_start");
result = isc_mem_create(0, 0, &mctx); result = isc_mem_create(&mctx);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
fatal("out of memory"); fatal("out of memory");
+1 -1
View File
@@ -1391,7 +1391,7 @@ main(int argc, char *argv[]) {
named_g_chrootdir); named_g_chrootdir);
} }
result = isc_mem_create(0, 0, &named_g_mctx); result = isc_mem_create(&named_g_mctx);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
named_main_earlyfatal("isc_mem_create() failed: %s", named_main_earlyfatal("isc_mem_create() failed: %s",
isc_result_totext(result)); isc_result_totext(result));
+2 -2
View File
@@ -4236,9 +4236,9 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist,
* cache, for the main cache memory and the heap * cache, for the main cache memory and the heap
* memory. * memory.
*/ */
CHECK(isc_mem_create(0, 0, &cmctx)); CHECK(isc_mem_create(&cmctx));
isc_mem_setname(cmctx, "cache", NULL); isc_mem_setname(cmctx, "cache", NULL);
CHECK(isc_mem_create(0, 0, &hmctx)); CHECK(isc_mem_create(&hmctx));
isc_mem_setname(hmctx, "cache_heap", NULL); isc_mem_setname(hmctx, "cache_heap", NULL);
CHECK(dns_cache_create(cmctx, hmctx, named_g_taskmgr, CHECK(dns_cache_create(cmctx, hmctx, named_g_taskmgr,
named_g_timermgr, view->rdclass, named_g_timermgr, view->rdclass,
+1 -1
View File
@@ -226,7 +226,7 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
return (ISC_R_FAILURE); return (ISC_R_FAILURE);
} }
result = isc_mem_create(0, 0, &mctx); result = isc_mem_create(&mctx);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
return (result); return (result);
+1 -1
View File
@@ -227,7 +227,7 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[],
return (ISC_R_FAILURE); return (ISC_R_FAILURE);
} }
isc_mem_create(0, 0, &mctx); isc_mem_create(&mctx);
cd = isc_mem_get(mctx, sizeof(*cd)); cd = isc_mem_get(mctx, sizeof(*cd));
if (cd == NULL) { if (cd == NULL) {
+1 -1
View File
@@ -3254,7 +3254,7 @@ main(int argc, char **argv) {
pre_parse_args(argc, argv); pre_parse_args(argc, argv);
result = isc_mem_create(0, 0, &gmctx); result = isc_mem_create(&gmctx);
check_result(result, "isc_mem_create"); check_result(result, "isc_mem_create");
parse_args(argc, argv); parse_args(argc, argv);
+1 -1
View File
@@ -67,7 +67,7 @@ main(int argc, char *argv[]) {
exit(1); exit(1);
} }
if (isc_mem_create(0, 0, &mctx) != ISC_R_SUCCESS) { if (isc_mem_create(&mctx) != ISC_R_SUCCESS) {
fprintf(stderr, "isc_mem_create() failed\n"); fprintf(stderr, "isc_mem_create() failed\n");
exit(1); exit(1);
} }
+1 -1
View File
@@ -932,7 +932,7 @@ main(int argc, char **argv) {
serial = isc_random32(); serial = isc_random32();
DO("create memory context", isc_mem_create(0, 0, &rndc_mctx)); DO("create memory context", isc_mem_create(&rndc_mctx));
DO("create socket manager", isc_socketmgr_create(rndc_mctx, &socketmgr)); DO("create socket manager", isc_socketmgr_create(rndc_mctx, &socketmgr));
DO("create task manager", isc_taskmgr_create(rndc_mctx, 1, 0, &taskmgr)); DO("create task manager", isc_taskmgr_create(rndc_mctx, 1, 0, &taskmgr));
DO("create task", isc_task_create(taskmgr, 0, &task)); DO("create task", isc_task_create(taskmgr, 0, &task));
+1 -1
View File
@@ -70,7 +70,7 @@ main(int argc, char **argv) {
char *filename = NULL; char *filename = NULL;
unsigned int zonetype = 0; unsigned int zonetype = 0;
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
result = isc_log_create(mctx, &lctx, &lcfg); result = isc_log_create(mctx, &lctx, &lcfg);
check_result(result, "isc_log_create()"); check_result(result, "isc_log_create()");
+1 -1
View File
@@ -97,7 +97,7 @@ main(int argc, char **argv) {
journal = argv[4]; journal = argv[4];
isc_mem_debugging |= ISC_MEM_DEBUGRECORD; isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
CHECK(isc_mem_create(0, 0, &mctx)); CHECK(isc_mem_create(&mctx));
CHECK(dst_lib_init(mctx, NULL)); CHECK(dst_lib_init(mctx, NULL));
dst_active = true; dst_active = true;
+1 -1
View File
@@ -297,7 +297,7 @@ main(int argc, char **argv) {
/* /*
* EVERYTHING needs a memory context. * EVERYTHING needs a memory context.
*/ */
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
cmp = NULL; cmp = NULL;
RUNTIME_CHECK(isc_mempool_create(mctx, sizeof(client_t), &cmp) RUNTIME_CHECK(isc_mempool_create(mctx, sizeof(client_t), &cmp)
+1 -1
View File
@@ -89,7 +89,7 @@ main(int argc, char *argv[]) {
dns_result_register(); dns_result_register();
mctx = NULL; mctx = NULL;
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
while ((ch = isc_commandline_parse(argc, argv, "nvw:")) != -1) { while ((ch = isc_commandline_parse(argc, argv, "nvw:")) != -1) {
switch (ch) { switch (ch) {
+1 -1
View File
@@ -203,7 +203,7 @@ main(int argc, char *argv[]) {
dns_result_register(); dns_result_register();
mctx = NULL; mctx = NULL;
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
while ((ch = isc_commandline_parse(argc, argv, "d:vw:")) != -1) { while ((ch = isc_commandline_parse(argc, argv, "d:vw:")) != -1) {
switch (ch) { switch (ch) {
+2 -7
View File
@@ -359,7 +359,6 @@ main(int argc, char *argv[]) {
dbinfo *dbi; dbinfo *dbi;
dns_dbversion_t *version; dns_dbversion_t *version;
const dns_name_t *origin; const dns_name_t *origin;
size_t memory_quota = 0;
dns_trust_t trust = 0; dns_trust_t trust = 0;
unsigned int addopts; unsigned int addopts;
isc_log_t *lctx = NULL; isc_log_t *lctx = NULL;
@@ -367,12 +366,12 @@ main(int argc, char *argv[]) {
dns_result_register(); dns_result_register();
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(dns_dbtable_create(mctx, dns_rdataclass_in, &dbtable) == RUNTIME_CHECK(dns_dbtable_create(mctx, dns_rdataclass_in, &dbtable) ==
ISC_R_SUCCESS); ISC_R_SUCCESS);
snprintf(dbtype, sizeof(dbtype), "rbt"); snprintf(dbtype, sizeof(dbtype), "rbt");
while ((ch = isc_commandline_parse(argc, argv, "c:d:t:z:P:Q:glpqvT")) while ((ch = isc_commandline_parse(argc, argv, "c:d:t:z:P:glpqvT"))
!= -1) { != -1) {
switch (ch) { switch (ch) {
case 'c': case 'c':
@@ -411,10 +410,6 @@ main(int argc, char *argv[]) {
case 'P': case 'P':
pause_every = atoi(isc_commandline_argument); pause_every = atoi(isc_commandline_argument);
break; break;
case 'Q':
memory_quota = atoi(isc_commandline_argument);
isc_mem_setquota(mctx, memory_quota);
break;
case 't': case 't':
type = atoi(isc_commandline_argument); type = atoi(isc_commandline_argument);
break; break;
+1 -1
View File
@@ -232,7 +232,7 @@ main(void) {
dns_name_t *name; dns_name_t *name;
isc_result_t result; isc_result_t result;
result = isc_mem_create(0, 0, &mctx); result = isc_mem_create(&mctx);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
return (1); return (1);
+1 -1
View File
@@ -447,7 +447,7 @@ main(int argc, char *argv[]) {
dns_result_register(); dns_result_register();
mctx = NULL; mctx = NULL;
RUNCHECK(isc_mem_create(0, 0, &mctx)); RUNCHECK(isc_mem_create(&mctx));
RUNCHECK(isc_log_create(mctx, &lctx, &lcfg)); RUNCHECK(isc_log_create(mctx, &lctx, &lcfg));
isc_log_setcontext(lctx); isc_log_setcontext(lctx);
+1 -1
View File
@@ -31,7 +31,7 @@ main(int argc, char **argv) {
UNUSED(argc); UNUSED(argc);
UNUSED(argv); UNUSED(argv);
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
result = isc_interfaceiter_create(mctx, &iter); result = isc_interfaceiter_create(mctx, &iter);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
goto cleanup; goto cleanup;
+1 -1
View File
@@ -91,7 +91,7 @@ main(int argc, char *argv[]) {
} }
} }
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_lex_create(mctx, 256, &lex) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_lex_create(mctx, 256, &lex) == ISC_R_SUCCESS);
if (masterfile) { if (masterfile) {
+1 -1
View File
@@ -108,7 +108,7 @@ main(int argc, char **argv) {
lctx = NULL; lctx = NULL;
lcfg = NULL; lcfg = NULL;
CHECK(isc_mem_create(0, 0, &mctx)); CHECK(isc_mem_create(&mctx));
CHECK(isc_log_create(mctx, &lctx, &lcfg)); CHECK(isc_log_create(mctx, &lctx, &lcfg));
CHECK(isc_log_settag(lcfg, progname)); CHECK(isc_log_settag(lcfg, progname));
+1 -1
View File
@@ -59,7 +59,7 @@ main(int argc, char *argv[]) {
UNUSED(argc); UNUSED(argc);
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
if (argv[1]) { if (argv[1]) {
isc_buffer_init(&source, argv[1], strlen(argv[1])); isc_buffer_init(&source, argv[1], strlen(argv[1]));
+1 -1
View File
@@ -33,7 +33,7 @@ main(int argc, char *argv[]) {
RUNTIME_CHECK(isc_mutex_init(&lock) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mutex_init(&lock) == ISC_R_SUCCESS);
mctx = NULL; mctx = NULL;
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
mp1 = NULL; mp1 = NULL;
RUNTIME_CHECK(isc_mempool_create(mctx, 24, &mp1) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mempool_create(mctx, 24, &mp1) == ISC_R_SUCCESS);
+1 -1
View File
@@ -192,7 +192,7 @@ main(int argc, char *argv[]) {
dns_result_register(); dns_result_register();
result = isc_mem_create(0, 0, &mctx); result = isc_mem_create(&mctx);
check_result(result, "isc_mem_create()"); check_result(result, "isc_mem_create()");
argc--; argc--;
+1 -1
View File
@@ -103,7 +103,7 @@ main(int argc, char *argv[]) {
isc_app_start(); isc_app_start();
isc_interval_set(&linterval, 1, 0); isc_interval_set(&linterval, 1, 0);
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_taskmgr_create(mctx, 3, 0, &taskmgr) == RUNTIME_CHECK(isc_taskmgr_create(mctx, 3, 0, &taskmgr) ==
ISC_R_SUCCESS); ISC_R_SUCCESS);
RUNTIME_CHECK(isc_timermgr_create(mctx, &timermgr) == RUNTIME_CHECK(isc_timermgr_create(mctx, &timermgr) ==
+1 -1
View File
@@ -283,7 +283,7 @@ main(int argc, char **argv) {
*/ */
isc_mem_debugging = ISC_MEM_DEBUGRECORD; isc_mem_debugging = ISC_MEM_DEBUGRECORD;
result = isc_mem_create(0, 0, &mctx); result = isc_mem_create(&mctx);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
printf("isc_mem_create: %s: exiting\n", printf("isc_mem_create: %s: exiting\n",
dns_result_totext(result)); dns_result_totext(result));
+2 -2
View File
@@ -180,9 +180,9 @@ main(int argc, char *argv[]) {
printf("%u workers\n", workers); printf("%u workers\n", workers);
mctx = NULL; mctx = NULL;
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
mctx2 = NULL; mctx2 = NULL;
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx2) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mem_create(&mctx2) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_taskmgr_create(mctx, workers, 0, &task_manager) == RUNTIME_CHECK(isc_taskmgr_create(mctx, workers, 0, &task_manager) ==
ISC_R_SUCCESS); ISC_R_SUCCESS);
RUNTIME_CHECK(isc_timermgr_create(mctx, &timer_manager) == RUNTIME_CHECK(isc_timermgr_create(mctx, &timer_manager) ==
+1 -1
View File
@@ -209,7 +209,7 @@ main(int argc, char *argv[]) {
RUNTIME_CHECK(isc_mutex_init(&lock) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mutex_init(&lock) == ISC_R_SUCCESS);
mctx = NULL; mctx = NULL;
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
while ((ch = isc_commandline_parse(argc, argv, "vp:")) != -1) { while ((ch = isc_commandline_parse(argc, argv, "vp:")) != -1) {
switch (ch) { switch (ch) {
+1 -1
View File
@@ -291,7 +291,7 @@ main(int argc, char *argv[]) {
* EVERYTHING needs a memory context. * EVERYTHING needs a memory context.
*/ */
mctx = NULL; mctx = NULL;
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
/* /*
* The task manager is independent (other than memory context) * The task manager is independent (other than memory context)
+1 -1
View File
@@ -61,7 +61,7 @@ main(int argc, char *argv[]) {
} }
} }
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_symtab_create(mctx, 691, undefine_action, NULL, RUNTIME_CHECK(isc_symtab_create(mctx, 691, undefine_action, NULL,
case_sensitive, &st) == ISC_R_SUCCESS); case_sensitive, &st) == ISC_R_SUCCESS);
+1 -1
View File
@@ -79,7 +79,7 @@ main(int argc, char *argv[]) {
workers = 2; workers = 2;
printf("%u workers\n", workers); printf("%u workers\n", workers);
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_taskmgr_create(mctx, workers, 0, &manager) == RUNTIME_CHECK(isc_taskmgr_create(mctx, workers, 0, &manager) ==
ISC_R_SUCCESS); ISC_R_SUCCESS);
+1 -1
View File
@@ -109,7 +109,7 @@ main(int argc, char *argv[]) {
workers = 2; workers = 2;
printf("%u workers\n", workers); printf("%u workers\n", workers);
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx1) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mem_create(&mctx1) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_taskmgr_create(mctx1, workers, 0, &manager) == RUNTIME_CHECK(isc_taskmgr_create(mctx1, workers, 0, &manager) ==
ISC_R_SUCCESS); ISC_R_SUCCESS);
RUNTIME_CHECK(isc_timermgr_create(mctx1, &timgr) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_timermgr_create(mctx1, &timgr) == ISC_R_SUCCESS);
+1 -1
View File
@@ -283,7 +283,7 @@ main(int argc, char **argv) {
usage(); usage();
RUNTIME_CHECK(isc_app_start() == ISC_R_SUCCESS); RUNTIME_CHECK(isc_app_start() == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_taskmgr_create(mctx, 2, 0, &taskmgr) == RUNTIME_CHECK(isc_taskmgr_create(mctx, 2, 0, &taskmgr) ==
ISC_R_SUCCESS); ISC_R_SUCCESS);
RUNTIME_CHECK(isc_timermgr_create(mctx, &timermgr) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_timermgr_create(mctx, &timermgr) == ISC_R_SUCCESS);
+1 -1
View File
@@ -270,7 +270,7 @@ main(int argc, char *argv[]) {
isc_sockaddr_fromin(&dstaddr, &inaddr, port); isc_sockaddr_fromin(&dstaddr, &inaddr, port);
mctx = NULL; mctx = NULL;
RUNCHECK(isc_mem_create(0, 0, &mctx)); RUNCHECK(isc_mem_create(&mctx));
lctx = NULL; lctx = NULL;
lcfg = NULL; lcfg = NULL;
+1 -1
View File
@@ -104,7 +104,7 @@ main(int argc, char **argv) {
dns_result_register(); dns_result_register();
CHECK(isc_mem_create(0, 0, &mctx), "isc_mem_create()"); CHECK(isc_mem_create(&mctx), "isc_mem_create()");
CHECK(dst_lib_init(mctx, NULL), "dst_lib_init()"); CHECK(dst_lib_init(mctx, NULL), "dst_lib_init()");
CHECK(isc_log_create(mctx, &log_, &logconfig), "isc_log_create()"); CHECK(isc_log_create(mctx, &log_, &logconfig), "isc_log_create()");
isc_log_setcontext(log_); isc_log_setcontext(log_);
+1 -1
View File
@@ -230,7 +230,7 @@ main(int argc, char *argv[]) {
mctx = NULL; mctx = NULL;
isc_mem_debugging = ISC_MEM_DEBUGRECORD; isc_mem_debugging = ISC_MEM_DEBUGRECORD;
RUNCHECK(isc_mem_create(0, 0, &mctx)); RUNCHECK(isc_mem_create(&mctx));
log = NULL; log = NULL;
logconfig = NULL; logconfig = NULL;
+1 -1
View File
@@ -169,7 +169,7 @@ main(int argc, char **argv) {
dns_result_register(); dns_result_register();
mctx = NULL; mctx = NULL;
RUNCHECK(isc_mem_create(0, 0, &mctx)); RUNCHECK(isc_mem_create(&mctx));
log = NULL; log = NULL;
logconfig = NULL; logconfig = NULL;
+1 -1
View File
@@ -138,7 +138,7 @@ main(int argc, char *argv[]) {
} }
isc_commandline_reset = true; isc_commandline_reset = true;
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) { while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
switch (ch) { switch (ch) {
+1 -1
View File
@@ -340,7 +340,7 @@ main(int argc, char *argv[]) {
if (argc < 1) if (argc < 1)
fatal("no file specified"); fatal("no file specified");
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
dns_result_register(); dns_result_register();
+1 -1
View File
@@ -1935,7 +1935,7 @@ main(int argc, char *argv[]) {
preparse_args(argc, argv); preparse_args(argc, argv);
mctx = NULL; mctx = NULL;
RUNCHECK(isc_mem_create(0, 0, &mctx)); RUNCHECK(isc_mem_create(&mctx));
lctx = NULL; lctx = NULL;
lcfg = NULL; lcfg = NULL;
+1 -1
View File
@@ -68,7 +68,7 @@ main(int argc, char **argv) {
file = argv[1]; file = argv[1];
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(setup_logging(mctx, stderr, &lctx) == ISC_R_SUCCESS); RUNTIME_CHECK(setup_logging(mctx, stderr, &lctx) == ISC_R_SUCCESS);
result = dns_journal_print(mctx, file, stdout); result = dns_journal_print(mctx, file, stdout);
+1 -1
View File
@@ -148,7 +148,7 @@ main(int argc, char *argv[]) {
if (doexit) if (doexit)
exit(0); exit(0);
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_lex_create(mctx, 256, &lex) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_lex_create(mctx, 256, &lex) == ISC_R_SUCCESS);
/* /*
+1 -1
View File
@@ -670,7 +670,7 @@ open_lexer(void) {
return ISC_R_SUCCESS; return ISC_R_SUCCESS;
/* allocate memory for lexer, and verify it was allocated */ /* allocate memory for lexer, and verify it was allocated */
result = isc_mem_create(0, 0, &lex_mctx); result = isc_mem_create(&lex_mctx);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
fprintf(stderr, "unexpected error creating lexer\n"); fprintf(stderr, "unexpected error creating lexer\n");
return result; return result;
+1 -1
View File
@@ -127,7 +127,7 @@ main(int argc, char *argv[])
if (argc != 4) usage(*argv); if (argc != 4) usage(*argv);
REQUIRE(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); REQUIRE(isc_mem_create(&mctx) == ISC_R_SUCCESS);
n = strlen(argv[1]); n = strlen(argv[1]);
isc_buffer_init(&b, argv[1], n); isc_buffer_init(&b, argv[1], n);
+1 -1
View File
@@ -152,7 +152,7 @@ main(int argc, char **argv) {
dns_result_register(); dns_result_register();
mctx = NULL; mctx = NULL;
result = isc_mem_create(0, 0, &mctx); result = isc_mem_create(&mctx);
check_result(result, "isc_mem_create"); check_result(result, "isc_mem_create");
isc_buffer_init(&b, porigin, strlen(porigin)); isc_buffer_init(&b, porigin, strlen(porigin));
+1 -1
View File
@@ -163,7 +163,7 @@ main(int argc, char *argv[])
dns_result_register(); dns_result_register();
result = isc_mem_create(0, 0, &mctx); result = isc_mem_create(&mctx);
check_result(result, "isc_mem_create"); check_result(result, "isc_mem_create");
isc_buffer_init(&b, porigin, strlen(porigin)); isc_buffer_init(&b, porigin, strlen(porigin));
+1 -1
View File
@@ -30,7 +30,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
static isc_mem_t *mctx = NULL; static isc_mem_t *mctx = NULL;
static void __attribute__((constructor)) init(void) { static void __attribute__((constructor)) init(void) {
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mem_create(&mctx) == ISC_R_SUCCESS);
RUNTIME_CHECK(dst_lib_init(mctx, NULL) == ISC_R_SUCCESS); RUNTIME_CHECK(dst_lib_init(mctx, NULL) == ISC_R_SUCCESS);
} }
+1 -1
View File
@@ -370,7 +370,7 @@ dns_client_create(dns_client_t **clientp, unsigned int options) {
unsigned int logdebuglevel = 0; unsigned int logdebuglevel = 0;
#endif #endif
result = isc_mem_create(0, 0, &mctx); result = isc_mem_create(&mctx);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
return (result); return (result);
result = isc_appctx_create(mctx, &actx); result = isc_appctx_create(mctx, &actx);
+1 -1
View File
@@ -167,7 +167,7 @@ dt_init(void) {
int ret; int ret;
if (dt_mctx == NULL) if (dt_mctx == NULL)
result = isc_mem_create(0, 0, &dt_mctx); result = isc_mem_create(&dt_mctx);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
goto unlock; goto unlock;
isc_mem_setname(dt_mctx, "dt", NULL); isc_mem_setname(dt_mctx, "dt", NULL);
+1 -1
View File
@@ -114,7 +114,7 @@ state_key_init(void) {
int ret; int ret;
if (state_mctx == NULL) if (state_mctx == NULL)
result = isc_mem_create(0, 0, &state_mctx); result = isc_mem_create(&state_mctx);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
goto unlock; goto unlock;
isc_mem_setname(state_mctx, "geoip_state", NULL); isc_mem_setname(state_mctx, "geoip_state", NULL);
+1 -1
View File
@@ -79,7 +79,7 @@ initialize(void) {
REQUIRE(initialize_done == false); REQUIRE(initialize_done == false);
result = isc_mem_create(0, 0, &dns_g_mctx); result = isc_mem_create(&dns_g_mctx);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
return; return;
dns_result_register(); dns_result_register();
+1 -1
View File
@@ -1301,7 +1301,7 @@ totext_filter_proc_key_init(void) {
if (!thread_key_initialized) { if (!thread_key_initialized) {
LOCK(&thread_key_mutex); LOCK(&thread_key_mutex);
if (thread_key_mctx == NULL) if (thread_key_mctx == NULL)
result = isc_mem_create(0, 0, &thread_key_mctx); result = isc_mem_create( &thread_key_mctx);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
goto unlock; goto unlock;
isc_mem_setname(thread_key_mctx, "threadkey", NULL); isc_mem_setname(thread_key_mctx, "threadkey", NULL);
+1 -1
View File
@@ -9910,7 +9910,7 @@ dns_resolver_create(dns_view_t *view,
* contention among multiple threads. Do this only when * contention among multiple threads. Do this only when
* enabling threads because it will be require more memory. * enabling threads because it will be require more memory.
*/ */
result = isc_mem_create(0, 0, &res->buckets[i].mctx); result = isc_mem_create(&res->buckets[i].mctx);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
isc_task_detach(&res->buckets[i].task); isc_task_detach(&res->buckets[i].task);
DESTROYLOCK(&res->buckets[i].lock); DESTROYLOCK(&res->buckets[i].lock);
+3 -3
View File
@@ -49,7 +49,7 @@ ATF_TC_BODY(getoriginnode, tc) {
isc_mem_t *mymctx = NULL; isc_mem_t *mymctx = NULL;
isc_result_t result; isc_result_t result;
result = isc_mem_create(0, 0, &mymctx); result = isc_mem_create(&mymctx);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = dns_db_create(mymctx, "rbt", dns_rootname, dns_dbtype_zone, result = dns_db_create(mymctx, "rbt", dns_rootname, dns_dbtype_zone,
@@ -79,7 +79,7 @@ ATF_TC_BODY(getsetservestalettl, tc) {
isc_result_t result; isc_result_t result;
dns_ttl_t ttl; dns_ttl_t ttl;
result = isc_mem_create(0, 0, &mymctx); result = isc_mem_create(&mymctx);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = dns_db_create(mymctx, "rbt", dns_rootname, dns_dbtype_cache, result = dns_db_create(mymctx, "rbt", dns_rootname, dns_dbtype_cache,
@@ -124,7 +124,7 @@ ATF_TC_BODY(dns_dbfind_staleok, tc) {
isc_result_t result; isc_result_t result;
unsigned char data[] = { 0x0a, 0x00, 0x00, 0x01 }; unsigned char data[] = { 0x0a, 0x00, 0x00, 0x01 };
result = isc_mem_create(0, 0, &mymctx); result = isc_mem_create(&mymctx);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = dns_db_create(mymctx, "rbt", dns_rootname, dns_dbtype_cache, result = dns_db_create(mymctx, "rbt", dns_rootname, dns_dbtype_cache,
+1 -1
View File
@@ -113,7 +113,7 @@ dns_test_begin(FILE *logfile, bool start_managers) {
CHECK(isc_app_start()); CHECK(isc_app_start());
if (debug_mem_record) if (debug_mem_record)
isc_mem_debugging |= ISC_MEM_DEBUGRECORD; isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
CHECK(isc_mem_create(0, 0, &mctx)); CHECK(isc_mem_create(&mctx));
CHECK(dst_lib_init(mctx, NULL)); CHECK(dst_lib_init(mctx, NULL));
dst_active = true; dst_active = true;
+1 -1
View File
@@ -818,7 +818,7 @@ dns_view_createresolver(dns_view_t *view,
dns_resolver_whenshutdown(view->resolver, view->task, &event); dns_resolver_whenshutdown(view->resolver, view->task, &event);
view->attributes &= ~DNS_VIEWATTR_RESSHUTDOWN; view->attributes &= ~DNS_VIEWATTR_RESSHUTDOWN;
result = isc_mem_create(0, 0, &mctx); result = isc_mem_create(&mctx);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
dns_resolver_shutdown(view->resolver); dns_resolver_shutdown(view->resolver);
return (result); return (result);
+1 -1
View File
@@ -16442,7 +16442,7 @@ mctxinit(void **target, void *arg) {
REQUIRE(target != NULL && *target == NULL); REQUIRE(target != NULL && *target == NULL);
result = isc_mem_create(0, 0, &mctx); result = isc_mem_create(&mctx);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
return (result); return (result);
isc_mem_setname(mctx, "zonemgr-pool", NULL); isc_mem_setname(mctx, "zonemgr-pool", NULL);
+1 -1
View File
@@ -96,7 +96,7 @@ ctxs_init(isc_mem_t **mctxp, isc_appctx_t **actxp,
{ {
isc_result_t result; isc_result_t result;
result = isc_mem_create(0, 0, mctxp); result = isc_mem_create(mctxp);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
goto fail; goto fail;
+1 -1
View File
@@ -30,7 +30,7 @@ static void
setup_test() { setup_test() {
isc_result_t result; isc_result_t result;
result = isc_mem_create(0, 0, &mctx); result = isc_mem_create(&mctx);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
/* /*
+3 -42
View File
@@ -111,19 +111,6 @@ LIBISC_EXTERNAL_DATA extern unsigned int isc_mem_defaultflags;
#define _ISC_MEM_FLARG #define _ISC_MEM_FLARG
#endif #endif
/*!
* Define ISC_MEM_USE_INTERNAL_MALLOC=1 to use the internal malloc()
* implementation in preference to the system one. The internal malloc()
* is very space-efficient, and quite fast on uniprocessor systems. It
* performs poorly on multiprocessor machines.
* JT: we can overcome the performance issue on multiprocessor machines
* by carefully separating memory contexts.
*/
#ifndef ISC_MEM_USE_INTERNAL_MALLOC
#define ISC_MEM_USE_INTERNAL_MALLOC 1
#endif
/* /*
* Flags for isc_mem_createx() calls. * Flags for isc_mem_createx() calls.
*/ */
@@ -131,11 +118,7 @@ LIBISC_EXTERNAL_DATA extern unsigned int isc_mem_defaultflags;
#define ISC_MEMFLAG_INTERNAL 0x00000002 /* use internal malloc */ #define ISC_MEMFLAG_INTERNAL 0x00000002 /* use internal malloc */
#define ISC_MEMFLAG_FILL 0x00000004 /* fill with pattern after alloc and frees */ #define ISC_MEMFLAG_FILL 0x00000004 /* fill with pattern after alloc and frees */
#if !ISC_MEM_USE_INTERNAL_MALLOC #define ISC_MEMFLAG_DEFAULT ISC_MEMFLAG_FILL
#define ISC_MEMFLAG_DEFAULT 0
#else
#define ISC_MEMFLAG_DEFAULT ISC_MEMFLAG_INTERNAL|ISC_MEMFLAG_FILL
#endif
/*% /*%
* isc_mem_putanddetach() is a convenience function for use where you * isc_mem_putanddetach() is a convenience function for use where you
@@ -166,19 +149,6 @@ LIBISC_EXTERNAL_DATA extern unsigned int isc_mem_defaultflags;
* \endcode * \endcode
*/ */
/*% memory and memory pool methods */
typedef struct isc_memmethods {
void *(*memget)(isc_mem_t *mctx, size_t size _ISC_MEM_FLARG);
void (*memput)(isc_mem_t *mctx, void *ptr, size_t size _ISC_MEM_FLARG);
void (*memputanddetach)(isc_mem_t **mctxp, void *ptr,
size_t size _ISC_MEM_FLARG);
void *(*memallocate)(isc_mem_t *mctx, size_t size _ISC_MEM_FLARG);
void *(*memreallocate)(isc_mem_t *mctx, void *ptr,
size_t size _ISC_MEM_FLARG);
char *(*memstrdup)(isc_mem_t *mctx, const char *s _ISC_MEM_FLARG);
void (*memfree)(isc_mem_t *mctx, void *ptr _ISC_MEM_FLARG);
} isc_memmethods_t;
/*% /*%
* This structure is actually just the common prefix of a memory context * This structure is actually just the common prefix of a memory context
* implementation's version of an isc_mem_t. * implementation's version of an isc_mem_t.
@@ -191,7 +161,6 @@ typedef struct isc_memmethods {
struct isc_mem { struct isc_mem {
unsigned int impmagic; unsigned int impmagic;
unsigned int magic; unsigned int magic;
isc_memmethods_t *methods;
}; };
#define ISCAPI_MCTX_MAGIC ISC_MAGIC('A','m','c','x') #define ISCAPI_MCTX_MAGIC ISC_MAGIC('A','m','c','x')
@@ -216,11 +185,6 @@ struct isc_mempool {
* (two underscores). The single-underscore macros are used to pass * (two underscores). The single-underscore macros are used to pass
* __FILE__ and __LINE__, and in the case of the put functions, to * __FILE__ and __LINE__, and in the case of the put functions, to
* set the pointer being freed to NULL in the calling function. * set the pointer being freed to NULL in the calling function.
*
* Many of these functions have a further isc___mem_<function>
* (three underscores) implementation, which is called indirectly
* via the isc_memmethods structure in the mctx so that dynamically
* loaded modules can use them even if named is statically linked.
*/ */
#define ISCMEMFUNC(sfx) isc__mem_ ## sfx #define ISCMEMFUNC(sfx) isc__mem_ ## sfx
@@ -255,13 +219,10 @@ struct isc_mempool {
/*@{*/ /*@{*/
isc_result_t isc_result_t
isc_mem_create(size_t max_size, size_t target_size, isc_mem_create(isc_mem_t **mctxp);
isc_mem_t **mctxp);
isc_result_t isc_result_t
isc_mem_createx(size_t max_size, size_t target_size, isc_mem_createx(isc_mem_t **mctxp, unsigned int flags);
isc_memalloc_t memalloc, isc_memfree_t memfree,
void *arg, isc_mem_t **mctxp, unsigned int flags);
/*!< /*!<
* \brief Create a memory context. * \brief Create a memory context.
+195 -797
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -56,7 +56,7 @@ ATF_TC_BODY(isc_heap_delete, tc) {
UNUSED(tc); UNUSED(tc);
result = isc_mem_create(0, 0, &mctx); result = isc_mem_create(&mctx);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = isc_heap_create(mctx, compare, idx, 0, &heap); result = isc_heap_create(mctx, compare, idx, 0, &heap);
+2 -18
View File
@@ -27,28 +27,13 @@
#include <isc/string.h> #include <isc/string.h>
#include <isc/util.h> #include <isc/util.h>
static void *
default_memalloc(void *arg, size_t size) {
UNUSED(arg);
if (size == 0U)
size = 1;
return (malloc(size));
}
static void
default_memfree(void *arg, void *ptr) {
UNUSED(arg);
free(ptr);
}
static void test_ht_full(int bits, uintptr_t count) { static void test_ht_full(int bits, uintptr_t count) {
isc_ht_t *ht = NULL; isc_ht_t *ht = NULL;
isc_result_t result; isc_result_t result;
isc_mem_t *mctx = NULL; isc_mem_t *mctx = NULL;
uintptr_t i; uintptr_t i;
result = isc_mem_createx(0, 0, default_memalloc, default_memfree, result = isc_mem_createx(&mctx, 0);
NULL, &mctx, 0);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = isc_ht_init(&ht, mctx, bits); result = isc_ht_init(&ht, mctx, bits);
@@ -200,8 +185,7 @@ static void test_ht_iterator() {
unsigned char *tkey; unsigned char *tkey;
size_t tksize; size_t tksize;
result = isc_mem_createx(0, 0, default_memalloc, default_memfree, result = isc_mem_createx(&mctx, 0);
NULL, &mctx, 0);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = isc_ht_init(&ht, mctx, 16); result = isc_ht_init(&ht, mctx, 16);
+1 -1
View File
@@ -100,7 +100,7 @@ isc_test_begin(FILE *logfile, bool start_managers,
isc_result_t result; isc_result_t result;
isc_mem_debugging |= ISC_MEM_DEBUGRECORD; isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
CHECK(isc_mem_create(0, 0, &mctx)); CHECK(isc_mem_create(&mctx));
if (logfile != NULL) { if (logfile != NULL) {
isc_logdestination_t destination; isc_logdestination_t destination;
+2 -2
View File
@@ -38,7 +38,7 @@ ATF_TC_BODY(lex_0xff, tc) {
UNUSED(tc); UNUSED(tc);
result = isc_mem_create(0, 0, &mctx); result = isc_mem_create(&mctx);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = isc_lex_create(mctx, 1024, &lex); result = isc_lex_create(mctx, 1024, &lex);
@@ -70,7 +70,7 @@ ATF_TC_BODY(lex_setline, tc) {
UNUSED(tc); UNUSED(tc);
result = isc_mem_create(0, 0, &mctx); result = isc_mem_create(&mctx);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = isc_lex_create(mctx, 1024, &lex); result = isc_lex_create(mctx, 1024, &lex);
+7 -27
View File
@@ -26,20 +26,6 @@
#include "isctest.h" #include "isctest.h"
static void *
default_memalloc(void *arg, size_t size) {
UNUSED(arg);
if (size == 0U)
size = 1;
return (malloc(size));
}
static void
default_memfree(void *arg, void *ptr) {
UNUSED(arg);
free(ptr);
}
ATF_TC(isc_mem); ATF_TC(isc_mem);
ATF_TC_HEAD(isc_mem, tc) { ATF_TC_HEAD(isc_mem, tc) {
atf_tc_set_md_var(tc, "descr", "general memory system tests"); atf_tc_set_md_var(tc, "descr", "general memory system tests");
@@ -65,7 +51,7 @@ ATF_TC_BODY(isc_mem, tc) {
result = isc_test_begin(NULL, true, 0); result = isc_test_begin(NULL, true, 0);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = isc_mem_create(0, 0, &localmctx); result = isc_mem_create(&localmctx);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = isc_mempool_create(localmctx, 24, &mp1); result = isc_mempool_create(localmctx, 24, &mp1);
@@ -139,8 +125,7 @@ ATF_TC_BODY(isc_mem, tc) {
isc_mem_destroy(&localmctx); isc_mem_destroy(&localmctx);
result = isc_mem_createx(0, 0, default_memalloc, default_memfree, result = isc_mem_createx(&localmctx,
NULL, &localmctx,
ISC_MEMFLAG_FILL | ISC_MEMFLAG_INTERNAL); ISC_MEMFLAG_FILL | ISC_MEMFLAG_INTERNAL);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
@@ -174,8 +159,7 @@ ATF_TC_BODY(isc_mem_total, tc) {
/* Local alloc, free */ /* Local alloc, free */
mctx2 = NULL; mctx2 = NULL;
result = isc_mem_createx(0, 0, default_memalloc, default_memfree, result = isc_mem_createx(&mctx2, 0);
NULL, &mctx2, 0);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
goto out; goto out;
@@ -240,8 +224,7 @@ ATF_TC_BODY(isc_mem_inuse, tc) {
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
mctx2 = NULL; mctx2 = NULL;
result = isc_mem_createx(0, 0, default_memalloc, default_memfree, result = isc_mem_createx(&mctx2, 0);
NULL, &mctx2, 0);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
goto out; goto out;
@@ -284,8 +267,7 @@ ATF_TC_BODY(isc_mem_noflags, tc) {
result = isc_test_begin(NULL, true, 0); result = isc_test_begin(NULL, true, 0);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = isc_mem_createx(0, 0, default_memalloc, default_memfree, result = isc_mem_createx(&mctx2, 0);
NULL, &mctx2, 0);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
isc_mem_debugging = 0; isc_mem_debugging = 0;
ptr = isc_mem_get(mctx2, 2048); ptr = isc_mem_get(mctx2, 2048);
@@ -336,8 +318,7 @@ ATF_TC_BODY(isc_mem_recordflag, tc) {
result = isc_test_begin(NULL, false, 0); result = isc_test_begin(NULL, false, 0);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = isc_mem_createx(0, 0, default_memalloc, default_memfree, result = isc_mem_createx(&mctx2, 0);
NULL, &mctx2, 0);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
ptr = isc_mem_get(mctx2, 2048); ptr = isc_mem_get(mctx2, 2048);
ATF_CHECK(ptr != NULL); ATF_CHECK(ptr != NULL);
@@ -386,8 +367,7 @@ ATF_TC_BODY(isc_mem_traceflag, tc) {
result = isc_test_begin(NULL, true, 0); result = isc_test_begin(NULL, true, 0);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = isc_mem_createx(0, 0, default_memalloc, default_memfree, result = isc_mem_createx(&mctx2, 0);
NULL, &mctx2, 0);
isc_mem_debugging = ISC_MEM_DEBUGTRACE; isc_mem_debugging = ISC_MEM_DEBUGTRACE;
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
ptr = isc_mem_get(mctx2, 2048); ptr = isc_mem_get(mctx2, 2048);
+1 -1
View File
@@ -276,7 +276,7 @@ random_test(pvalue_func_t *func, isc_random_func test_func) {
tables_init(); tables_init();
result = isc_mem_create(0, 0, &mctx); result = isc_mem_create(&mctx);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
m = 1000; m = 1000;
+1 -1
View File
@@ -691,7 +691,7 @@ ATF_TC_BODY(manytasks, tc) {
result = isc_condition_init(&cv); result = isc_condition_init(&cv);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = isc_mem_create(0, 0, &mctx); result = isc_mem_create(&mctx);
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
result = isc_taskmgr_create(mctx, 4, 0, &taskmgr); result = isc_taskmgr_create(mctx, 4, 0, &taskmgr);
+1 -1
View File
@@ -63,7 +63,7 @@ setup() {
isc_result_t result; isc_result_t result;
isc_mem_debugging |= ISC_MEM_DEBUGRECORD; isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
CHECK(isc_mem_create(0, 0, &mctx)); CHECK(isc_mem_create(&mctx));
isc_logdestination_t destination; isc_logdestination_t destination;
isc_logconfig_t *logconfig = NULL; isc_logconfig_t *logconfig = NULL;
+2 -2
View File
@@ -2903,7 +2903,7 @@ get_clientmctx(ns_clientmgr_t *manager, isc_mem_t **mctxp) {
* Caller must be holding the manager lock. * Caller must be holding the manager lock.
*/ */
if ((manager->sctx->options & NS_SERVER_CLIENTTEST) != 0) { if ((manager->sctx->options & NS_SERVER_CLIENTTEST) != 0) {
result = isc_mem_create(0, 0, mctxp); result = isc_mem_create(mctxp);
if (result == ISC_R_SUCCESS) if (result == ISC_R_SUCCESS)
isc_mem_setname(*mctxp, "client", NULL); isc_mem_setname(*mctxp, "client", NULL);
return (result); return (result);
@@ -2917,7 +2917,7 @@ get_clientmctx(ns_clientmgr_t *manager, isc_mem_t **mctxp) {
clientmctx = manager->mctxpool[nextmctx]; clientmctx = manager->mctxpool[nextmctx];
if (clientmctx == NULL) { if (clientmctx == NULL) {
result = isc_mem_create(0, 0, &clientmctx); result = isc_mem_create(&clientmctx);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
return (result); return (result);
isc_mem_setname(clientmctx, "client", NULL); isc_mem_setname(clientmctx, "client", NULL);
+1 -1
View File
@@ -50,7 +50,7 @@ initialize(void) {
REQUIRE(initialize_done == false); REQUIRE(initialize_done == false);
result = isc_mem_create(0, 0, &ns_g_mctx); result = isc_mem_create(&ns_g_mctx);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
return; return;
+1 -1
View File
@@ -227,7 +227,7 @@ ns_test_begin(FILE *logfile, bool start_managers) {
CHECK(isc_app_start()); CHECK(isc_app_start());
if (debug_mem_record) if (debug_mem_record)
isc_mem_debugging |= ISC_MEM_DEBUGRECORD; isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
CHECK(isc_mem_create(0, 0, &mctx)); CHECK(isc_mem_create(&mctx));
CHECK(dst_lib_init(mctx, NULL)); CHECK(dst_lib_init(mctx, NULL));
dst_active = true; dst_active = true;
+1 -1
View File
@@ -218,7 +218,7 @@ ctxs_init(isc_mem_t **mctxp, isc_appctx_t **actxp,
{ {
isc_result_t result; isc_result_t result;
result = isc_mem_create(0, 0, mctxp); result = isc_mem_create(mctxp);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
goto fail; goto fail;
+2 -2
View File
@@ -115,7 +115,7 @@ set_key(dns_client_t *client, char *keynamestr, char *keystr,
isc_region_t r; isc_region_t r;
dns_secalg_t alg; dns_secalg_t alg;
result = isc_mem_create(0, 0, mctxp); result = isc_mem_create(mctxp);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
fprintf(stderr, "failed to create mctx\n"); fprintf(stderr, "failed to create mctx\n");
exit(1); exit(1);
@@ -369,7 +369,7 @@ main(int argc, char *argv[]) {
exit(1); exit(1);
} }
result = isc_mem_create(0, 0, &mctx); result = isc_mem_create(&mctx);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
fprintf(stderr, "failed to crate mctx\n"); fprintf(stderr, "failed to crate mctx\n");
exit(1); exit(1);
+1 -1
View File
@@ -100,7 +100,7 @@ ctxs_init(isc_mem_t **mctxp, isc_appctx_t **actxp,
{ {
isc_result_t result; isc_result_t result;
result = isc_mem_create(0, 0, mctxp); result = isc_mem_create(mctxp);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
goto fail; goto fail;
+1 -1
View File
@@ -191,7 +191,7 @@ main(int argc, char *argv[]) {
qmessage = NULL; qmessage = NULL;
rmessage = NULL; rmessage = NULL;
result = isc_mem_create(0, 0, &mctx); result = isc_mem_create(&mctx);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
fprintf(stderr, "failed to create a memory context\n"); fprintf(stderr, "failed to create a memory context\n");
exit(1); exit(1);
+1 -1
View File
@@ -243,7 +243,7 @@ main(int argc, char *argv[]) {
fprintf(stderr, "dns_lib_init failed: %u\n", result); fprintf(stderr, "dns_lib_init failed: %u\n", result);
exit(1); exit(1);
} }
result = isc_mem_create(0, 0, &umctx); result = isc_mem_create(&umctx);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
fprintf(stderr, "failed to crate mctx\n"); fprintf(stderr, "failed to crate mctx\n");
exit(1); exit(1);