From: Colin Vidal Date: Tue, 4 Nov 2025 09:46:05 +0000 (+0100) Subject: cfg_parse_ API doesn't need memory context X-Git-Tag: v9.21.17~63^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f7b64e2e87a6c13b49c40f4b67e87f1c751b6880;p=thirdparty%2Fbind9.git cfg_parse_ API doesn't need memory context Because the parser now uses global memory context, the cfg_parse_* API doesn't take a memory context anymore. --- diff --git a/bin/check/named-checkconf.c b/bin/check/named-checkconf.c index 5b2c934e523..a40a4b703c5 100644 --- a/bin/check/named-checkconf.c +++ b/bin/check/named-checkconf.c @@ -531,11 +531,11 @@ parse_builtin(cfg_obj_t **defaultconfig) { sizeof(common_named_defaultconf) - 1); isc_buffer_add(&b, sizeof(common_named_defaultconf) - 1); - return cfg_parse_buffer( - isc_g_mctx, &b, __FILE__, 0, &cfg_type_namedconf, - CFG_PCTX_NODEPRECATED | CFG_PCTX_NOOBSOLETE | - CFG_PCTX_NOEXPERIMENTAL | CFG_PCTX_BUILTIN, - defaultconfig); + return cfg_parse_buffer(&b, __FILE__, 0, &cfg_type_namedconf, + CFG_PCTX_NODEPRECATED | CFG_PCTX_NOOBSOLETE | + CFG_PCTX_NOEXPERIMENTAL | + CFG_PCTX_BUILTIN, + defaultconfig); } static void @@ -714,8 +714,8 @@ main(int argc, char **argv) { } CHECK(setup_logging(stdout)); - CHECK(cfg_parse_file(isc_g_mctx, conffile, &cfg_type_namedconf, - parserflags, &config)); + CHECK(cfg_parse_file(conffile, &cfg_type_namedconf, parserflags, + &config)); CHECK(isccfg_check_namedconf(config, checkflags, isc_g_mctx)); if (load_zones || list_zones) { CHECK(load_zones_fromconfig(config, list_zones)); diff --git a/bin/delv/delv.c b/bin/delv/delv.c index 262497da41d..0d69fb79d35 100644 --- a/bin/delv/delv.c +++ b/bin/delv/delv.c @@ -829,8 +829,8 @@ setup_dnsseckeys(dns_client_t *client, dns_view_t *toview) { fatal("Unable to read key file '%s'", anchorfile); } - result = cfg_parse_file(isc_g_mctx, anchorfile, - &cfg_type_bindkeys, 0, &bindkeys); + result = cfg_parse_file(anchorfile, &cfg_type_bindkeys, 0, + &bindkeys); if (result != ISC_R_SUCCESS) { fatal("Unable to load keys from '%s'", anchorfile); } @@ -842,8 +842,8 @@ setup_dnsseckeys(dns_client_t *client, dns_view_t *toview) { isc_buffer_init(&b, anchortext, sizeof(anchortext) - 1); isc_buffer_add(&b, sizeof(anchortext) - 1); - result = cfg_parse_buffer(isc_g_mctx, &b, NULL, 0, &delv_type, - 0, &bindkeys); + result = cfg_parse_buffer(&b, NULL, 0, &delv_type, 0, + &bindkeys); if (result != ISC_R_SUCCESS) { fatal("Unable to parse built-in keys"); } diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index 80253b18d6d..4c0af64d64b 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -1062,8 +1062,7 @@ read_confkey(void) { return ISC_R_FILENOTFOUND; } - CHECK(cfg_parse_file(isc_g_mctx, keyfile, &cfg_type_sessionkey, 0, - &file)); + CHECK(cfg_parse_file(keyfile, &cfg_type_sessionkey, 0, &file)); CHECK(cfg_map_get(file, "key", &keyobj)); diff --git a/bin/dnssec/dnssec-keygen.c b/bin/dnssec/dnssec-keygen.c index 17556b17b9c..4b222de72ee 100644 --- a/bin/dnssec/dnssec-keygen.c +++ b/bin/dnssec/dnssec-keygen.c @@ -1150,9 +1150,8 @@ main(int argc, char **argv) { cfg_obj_t *config = NULL; dns_kasp_t *kasp = NULL; - if (cfg_parse_file(isc_g_mctx, ctx.configfile, - &cfg_type_namedconf, 0, - &config) != ISC_R_SUCCESS) + if (cfg_parse_file(ctx.configfile, &cfg_type_namedconf, + 0, &config) != ISC_R_SUCCESS) { fatal("unable to load dnssec-policy '%s' from " "'%s'", diff --git a/bin/dnssec/dnssec-ksr.c b/bin/dnssec/dnssec-ksr.c index 8f0c61c7a1c..9664653d0bd 100644 --- a/bin/dnssec/dnssec-ksr.c +++ b/bin/dnssec/dnssec-ksr.c @@ -157,8 +157,8 @@ static void getkasp(ksr_ctx_t *ksr, dns_kasp_t **kasp) { cfg_obj_t *config = NULL; - if (cfg_parse_file(isc_g_mctx, ksr->configfile, &cfg_type_namedconf, 0, - &config) != ISC_R_SUCCESS) + if (cfg_parse_file(ksr->configfile, &cfg_type_namedconf, 0, &config) != + ISC_R_SUCCESS) { fatal("unable to load dnssec-policy '%s' from '%s'", ksr->policy, ksr->configfile); diff --git a/bin/named/config.c b/bin/named/config.c index c953f4c45a9..7c74b527393 100644 --- a/bin/named/config.c +++ b/bin/named/config.c @@ -55,11 +55,11 @@ named_config_parsedefaults(cfg_obj_t **conf) { isc_buffer_constinit(&b, common_named_defaultconf, sizeof(common_named_defaultconf) - 1); isc_buffer_add(&b, sizeof(common_named_defaultconf) - 1); - return cfg_parse_buffer( - isc_g_mctx, &b, __FILE__, 0, &cfg_type_namedconf, - CFG_PCTX_NODEPRECATED | CFG_PCTX_NOOBSOLETE | - CFG_PCTX_NOEXPERIMENTAL | CFG_PCTX_BUILTIN, - conf); + return cfg_parse_buffer(&b, __FILE__, 0, &cfg_type_namedconf, + CFG_PCTX_NODEPRECATED | CFG_PCTX_NOOBSOLETE | + CFG_PCTX_NOEXPERIMENTAL | + CFG_PCTX_BUILTIN, + conf); } isc_result_t @@ -72,8 +72,7 @@ named_config_parsefile(cfg_obj_t **conf) { ISC_LOG_INFO, "parsing user configuration from '%s'", named_g_conffile); - CHECK(cfg_parse_file(isc_g_mctx, named_g_conffile, &cfg_type_namedconf, - 0, conf)); + CHECK(cfg_parse_file(named_g_conffile, &cfg_type_namedconf, 0, conf)); /* * Check the validity of the configuration. diff --git a/bin/named/controlconf.c b/bin/named/controlconf.c index 4653bcafa74..048b88f0872 100644 --- a/bin/named/controlconf.c +++ b/bin/named/controlconf.c @@ -787,8 +787,7 @@ get_rndckey(isc_mem_t *mctx, controlkeylist_t *keyids) { return ISC_R_FILENOTFOUND; } - CHECK(cfg_parse_file(mctx, named_g_keyfile, &cfg_type_rndckey, 0, - &config)); + CHECK(cfg_parse_file(named_g_keyfile, &cfg_type_rndckey, 0, &config)); CHECK(cfg_map_get(config, "key", &key)); keyid = isc_mem_get(mctx, sizeof(*keyid)); diff --git a/bin/named/server.c b/bin/named/server.c index 4dc7b91afac..cb03db4d620 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -2350,7 +2350,7 @@ catz_addmodzone_cb(void *arg) { confbuf = NULL; result = dns_catz_generate_zonecfg(cz->origin, cz->entry, &confbuf); if (result == ISC_R_SUCCESS) { - result = cfg_parse_buffer(isc_g_mctx, confbuf, "catz", 0, + result = cfg_parse_buffer(confbuf, "catz", 0, &cfg_type_addzoneconf, 0, &zoneconf); isc_buffer_free(&confbuf); } @@ -2618,7 +2618,7 @@ catz_reconfigure(dns_catz_entry_t *entry, void *arg1, void *arg2) { result = dns_catz_generate_zonecfg(data->catz, entry, &confbuf); if (result == ISC_R_SUCCESS) { - result = cfg_parse_buffer(isc_g_mctx, confbuf, "catz", 0, + result = cfg_parse_buffer(confbuf, "catz", 0, &cfg_type_addzoneconf, 0, &zoneconf); isc_buffer_free(&confbuf); } @@ -7294,8 +7294,8 @@ data_to_cfg(dns_view_t *view, MDB_val *key, MDB_val *data, isc_buffer_t *text, snprintf(bufname, sizeof(bufname), "%.*s", (int)zone_name_len, zone_name); - result = cfg_parse_buffer(isc_g_mctx, text, bufname, 0, - &cfg_type_addzoneconf, 0, &zoneconf); + result = cfg_parse_buffer(text, bufname, 0, &cfg_type_addzoneconf, 0, + &zoneconf); if (result != ISC_R_SUCCESS) { isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR, @@ -8920,9 +8920,9 @@ load_configuration(named_server_t *server, bool first_time) { "keys instead", named_g_bindkeysfile); } else { - result = cfg_parse_file( - isc_g_mctx, named_g_bindkeysfile, - &cfg_type_bindkeys, 0, &bindkeys); + result = cfg_parse_file(named_g_bindkeysfile, + &cfg_type_bindkeys, 0, + &bindkeys); if (result != ISC_R_SUCCESS) { isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER, @@ -12129,8 +12129,7 @@ load_nzf(dns_view_t *view) { /* * Parse the configuration in the NZF file. */ - result = cfg_parse_file(view->mctx, view->newzone.file, - &cfg_type_addzoneconf, 0, + result = cfg_parse_file(view->newzone.file, &cfg_type_addzoneconf, 0, &view->newzone.nzconfig); if (result != ISC_R_SUCCESS) { isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER, @@ -12496,8 +12495,8 @@ load_nzf(dns_view_t *view) { * config type, giving us a guarantee that valid configuration * will be written to DB. */ - result = cfg_parse_file(isc_g_mctx, view->newzone.file, - &cfg_type_addzoneconf, 0, &nzf_config); + result = cfg_parse_file(view->newzone.file, &cfg_type_addzoneconf, 0, + &nzf_config); if (result != ISC_R_SUCCESS) { isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR, "Error parsing NZF file '%s': %s", @@ -12647,8 +12646,8 @@ newzone_parse(named_server_t *server, char *command, dns_view_t **viewp, */ isc_buffer_forward(&argbuf, 3); - CHECK(cfg_parse_buffer(server->mctx, &argbuf, bn, 0, - &cfg_type_addzoneconf, 0, &zoneconf)); + CHECK(cfg_parse_buffer(&argbuf, bn, 0, &cfg_type_addzoneconf, 0, + &zoneconf)); CHECK(cfg_map_get(zoneconf, "zone", &zlist)); if (!cfg_obj_islist(zlist)) { diff --git a/bin/nsupdate/nsupdate.c b/bin/nsupdate/nsupdate.c index cc8e5b4cd62..820029d3e84 100644 --- a/bin/nsupdate/nsupdate.c +++ b/bin/nsupdate/nsupdate.c @@ -569,8 +569,7 @@ read_sessionkey(isc_mem_t *mctx) { return ISC_R_FILENOTFOUND; } - CHECK(cfg_parse_file(mctx, keyfile, &cfg_type_sessionkey, 0, - &sessionkey)); + CHECK(cfg_parse_file(keyfile, &cfg_type_sessionkey, 0, &sessionkey)); CHECK(cfg_map_get(sessionkey, "key", &key)); diff --git a/bin/plugins/filter-a.c b/bin/plugins/filter-a.c index d5a9d0b2688..541bb7ebc50 100644 --- a/bin/plugins/filter-a.c +++ b/bin/plugins/filter-a.c @@ -272,8 +272,8 @@ parse_parameters(filter_instance_t *inst, const char *parameters, isc_buffer_constinit(&b, parameters, strlen(parameters)); isc_buffer_add(&b, strlen(parameters)); - CHECK(cfg_parse_buffer(mctx, &b, cfg_file, cfg_line, - &cfg_type_parameters, 0, ¶m_obj)); + CHECK(cfg_parse_buffer(&b, cfg_file, cfg_line, &cfg_type_parameters, 0, + ¶m_obj)); CHECK(parse_filter_a_on(param_obj, "filter-a-on-v6", &inst->v6_a)); CHECK(parse_filter_a_on(param_obj, "filter-a-on-v4", &inst->v4_a)); @@ -359,8 +359,8 @@ plugin_check(const char *parameters, const void *cfg, const char *cfg_file, isc_buffer_constinit(&b, parameters, strlen(parameters)); isc_buffer_add(&b, strlen(parameters)); - CHECK(cfg_parse_buffer(mctx, &b, cfg_file, cfg_line, - &cfg_type_parameters, 0, ¶m_obj)); + CHECK(cfg_parse_buffer(&b, cfg_file, cfg_line, &cfg_type_parameters, 0, + ¶m_obj)); CHECK(check_syntax(param_obj, cfg, mctx, aclctx)); diff --git a/bin/plugins/filter-aaaa.c b/bin/plugins/filter-aaaa.c index 007d952e7e1..8173b736c7f 100644 --- a/bin/plugins/filter-aaaa.c +++ b/bin/plugins/filter-aaaa.c @@ -273,8 +273,8 @@ parse_parameters(filter_instance_t *inst, const char *parameters, isc_buffer_constinit(&b, parameters, strlen(parameters)); isc_buffer_add(&b, strlen(parameters)); - CHECK(cfg_parse_buffer(mctx, &b, cfg_file, cfg_line, - &cfg_type_parameters, 0, ¶m_obj)); + CHECK(cfg_parse_buffer(&b, cfg_file, cfg_line, &cfg_type_parameters, 0, + ¶m_obj)); CHECK(parse_filter_aaaa_on(param_obj, "filter-aaaa-on-v4", &inst->v4_aaaa)); @@ -363,8 +363,8 @@ plugin_check(const char *parameters, const void *cfg, const char *cfg_file, isc_buffer_constinit(&b, parameters, strlen(parameters)); isc_buffer_add(&b, strlen(parameters)); - CHECK(cfg_parse_buffer(mctx, &b, cfg_file, cfg_line, - &cfg_type_parameters, 0, ¶m_obj)); + CHECK(cfg_parse_buffer(&b, cfg_file, cfg_line, &cfg_type_parameters, 0, + ¶m_obj)); CHECK(check_syntax(param_obj, cfg, mctx, aclctx)); diff --git a/bin/plugins/synthrecord.c b/bin/plugins/synthrecord.c index 8dc3e257b12..895f2f7df2e 100644 --- a/bin/plugins/synthrecord.c +++ b/bin/plugins/synthrecord.c @@ -554,15 +554,14 @@ synthrecord_parseconfig(synthrecord_t *inst, const char *parameters, unsigned long cfgline, cfg_aclconfctx_t *aclctx, const dns_name_t *zname) { isc_result_t result; - isc_mem_t *mctx = inst->mctx; cfg_obj_t *synthrecordcfg = NULL; isc_buffer_t b; isc_buffer_constinit(&b, parameters, strlen(parameters)); isc_buffer_add(&b, strlen(parameters)); - CHECK(cfg_parse_buffer(mctx, &b, cfgfile, cfgline, - &synthrecord_cfgparams, 0, &synthrecordcfg)); + CHECK(cfg_parse_buffer(&b, cfgfile, cfgline, &synthrecord_cfgparams, 0, + &synthrecordcfg)); synthrecord_setconfigmode(inst, zname); CHECK(synthrecord_initorigin(inst, synthrecordcfg, zname)); diff --git a/bin/rndc/rndc.c b/bin/rndc/rndc.c index 66660351ba1..dc5b536f4e6 100644 --- a/bin/rndc/rndc.c +++ b/bin/rndc/rndc.c @@ -537,7 +537,7 @@ rndc_start(void *arg) { } static void -parse_config(isc_mem_t *mctx, const char *keyname, cfg_obj_t **configp) { +parse_config(const char *keyname, cfg_obj_t **configp) { isc_result_t result; const char *conffile = admin_conffile; const cfg_obj_t *addresses = NULL; @@ -581,7 +581,7 @@ parse_config(isc_mem_t *mctx, const char *keyname, cfg_obj_t **configp) { /* * The parser will output its own errors, so DO() is not used. */ - result = cfg_parse_file(mctx, conffile, conftype, 0, &config); + result = cfg_parse_file(conffile, conftype, 0, &config); if (result != ISC_R_SUCCESS) { fatal("could not load rndc configuration"); } @@ -961,7 +961,7 @@ main(int argc, char **argv) { ISC_LOG_PRINTTAG | ISC_LOG_PRINTLEVEL, ISC_LOGCATEGORY_DEFAULT, ISC_LOGMODULE_DEFAULT); - parse_config(isc_g_mctx, keyname, &config); + parse_config(keyname, &config); isc_buffer_allocate(isc_g_mctx, &databuf, 2048); diff --git a/bin/tests/system/hooks/driver/test-syncplugin.c b/bin/tests/system/hooks/driver/test-syncplugin.c index 36409bbda96..c125f335d67 100644 --- a/bin/tests/system/hooks/driver/test-syncplugin.c +++ b/bin/tests/system/hooks/driver/test-syncplugin.c @@ -126,8 +126,8 @@ plugin_register(const char *parameters, const void *cfg, const char *cfgfile, isc_buffer_constinit(&b, parameters, strlen(parameters)); isc_buffer_add(&b, strlen(parameters)); - CHECK(cfg_parse_buffer(mctx, &b, cfgfile, cfgline, - &syncplugin__cfgparams, 0, &syncplugincfg)); + CHECK(cfg_parse_buffer(&b, cfgfile, cfgline, &syncplugin__cfgparams, 0, + &syncplugincfg)); CHECK(syncplugin__parse_rcode(syncplugincfg, &inst->rcode)); diff --git a/doc/misc/cfg_test.c b/doc/misc/cfg_test.c index f29600c2aa7..cb17b35e1b9 100644 --- a/doc/misc/cfg_test.c +++ b/doc/misc/cfg_test.c @@ -133,7 +133,7 @@ main(int argc, char **argv) { if (type == NULL || filename == NULL) { usage(); } - result = cfg_parse_file(mctx, filename, type, 0, &cfg); + result = cfg_parse_file(filename, type, 0, &cfg); fprintf(stderr, "read config: %s\n", isc_result_totext(result)); @@ -147,6 +147,10 @@ main(int argc, char **argv) { } if (memstats) { + /* + * TODO: this is memstat of config that we are interested in + * here, right? + */ isc_mem_stats(mctx, stderr); } isc_mem_detach(&mctx); diff --git a/lib/isccfg/include/isccfg/cfg.h b/lib/isccfg/include/isccfg/cfg.h index 882ac2cca15..5012f492171 100644 --- a/lib/isccfg/include/isccfg/cfg.h +++ b/lib/isccfg/include/isccfg/cfg.h @@ -91,13 +91,12 @@ typedef isc_result_t (*cfg_parsecallback_t)(const char *clausename, ***/ isc_result_t -cfg_parse_file(isc_mem_t *mctx, const char *file, const cfg_type_t *type, - unsigned int flags, cfg_obj_t **ret); +cfg_parse_file(const char *file, const cfg_type_t *type, unsigned int flags, + cfg_obj_t **ret); isc_result_t -cfg_parse_buffer(isc_mem_t *mctx, isc_buffer_t *buffer, const char *file, - unsigned int line, const cfg_type_t *type, unsigned int flags, - cfg_obj_t **ret); +cfg_parse_buffer(isc_buffer_t *buffer, const char *file, unsigned int line, + const cfg_type_t *type, unsigned int flags, cfg_obj_t **ret); /*%< * Read a configuration containing data of type 'type' * and make '*ret' point to its parse tree. diff --git a/lib/isccfg/parser.c b/lib/isccfg/parser.c index 188d34226b8..202609a6f4d 100644 --- a/lib/isccfg/parser.c +++ b/lib/isccfg/parser.c @@ -680,17 +680,16 @@ static cfg_type_t cfg_type_filelist = { "filelist", NULL, &cfg_rep_list, &cfg_type_qstring }; static void -parser_create(isc_mem_t *mctx, cfg_parser_t **ret) { +parser_create(cfg_parser_t **ret) { cfg_parser_t *pctx; isc_lexspecials_t specials; - REQUIRE(mctx != NULL); REQUIRE(ret != NULL && *ret == NULL); - pctx = isc_mem_get(mctx, sizeof(*pctx)); + pctx = isc_mem_get(isc_g_mctx, sizeof(*pctx)); pctx->mctx = NULL; - isc_mem_attach(mctx, &pctx->mctx); + isc_mem_attach(isc_g_mctx, &pctx->mctx); pctx->lexer = NULL; pctx->seen_eof = false; @@ -712,14 +711,14 @@ parser_create(isc_mem_t *mctx, cfg_parser_t **ret) { specials['"'] = 1; specials['!'] = 1; - isc_lex_create(pctx->mctx, 1024, &pctx->lexer); + isc_lex_create(isc_g_mctx, 1024, &pctx->lexer); isc_lex_setspecials(pctx->lexer, specials); isc_lex_setcomments(pctx->lexer, ISC_LEXCOMMENT_C | ISC_LEXCOMMENT_CPLUSPLUS | ISC_LEXCOMMENT_SHELL); - create_list(pctx->mctx, cfg_parser_currentfile(pctx), pctx->line, + create_list(isc_g_mctx, cfg_parser_currentfile(pctx), pctx->line, &cfg_type_filelist, &pctx->open_files); create_list(pctx->mctx, cfg_parser_currentfile(pctx), pctx->line, &cfg_type_filelist, &pctx->closed_files); @@ -811,19 +810,18 @@ cleanup: CFG_PCTX_NOEXPERIMENTAL | CFG_PCTX_BUILTIN)) == 0) isc_result_t -cfg_parse_file(isc_mem_t *mctx, const char *filename, const cfg_type_t *type, - unsigned int flags, cfg_obj_t **ret) { +cfg_parse_file(const char *filename, const cfg_type_t *type, unsigned int flags, + cfg_obj_t **ret) { isc_result_t result; cfg_listelt_t *elt; cfg_parser_t *pctx = NULL; - REQUIRE(mctx != NULL); REQUIRE(filename != NULL); REQUIRE(type != NULL); REQUIRE(ret != NULL && *ret == NULL); REQUIRE_PCTX_FLAGS(flags); - parser_create(mctx, &pctx); + parser_create(&pctx); pctx->flags = flags; CHECK(parser_openfile(pctx, filename)); @@ -843,19 +841,17 @@ cleanup: } isc_result_t -cfg_parse_buffer(isc_mem_t *mctx, isc_buffer_t *buffer, const char *file, - unsigned int line, const cfg_type_t *type, unsigned int flags, - cfg_obj_t **ret) { +cfg_parse_buffer(isc_buffer_t *buffer, const char *file, unsigned int line, + const cfg_type_t *type, unsigned int flags, cfg_obj_t **ret) { isc_result_t result; cfg_parser_t *pctx = NULL; - REQUIRE(mctx != NULL); REQUIRE(type != NULL); REQUIRE(buffer != NULL); REQUIRE(ret != NULL && *ret == NULL); REQUIRE_PCTX_FLAGS(flags); - parser_create(mctx, &pctx); + parser_create(&pctx); CHECK(isc_lex_openbuffer(pctx->lexer, buffer)); pctx->buf_name = file; diff --git a/tests/isccfg/duration_test.c b/tests/isccfg/duration_test.c index a9cb1fd021d..fbe63046a2f 100644 --- a/tests/isccfg/duration_test.c +++ b/tests/isccfg/duration_test.c @@ -143,7 +143,7 @@ ISC_RUN_TEST_IMPL(duration) { isc_buffer_add(&buf1, strlen(conf) - 1); /* Parse with default line numbering */ - result = cfg_parse_buffer(isc_g_mctx, &buf1, "text1", 0, + result = cfg_parse_buffer(&buf1, "text1", 0, &cfg_type_namedconf, 0, &c1); if (must_fail) { assert_int_equal(result, DNS_R_BADTTL); diff --git a/tests/isccfg/grammar_test.c b/tests/isccfg/grammar_test.c index 59ea8241125..ad524dcbddb 100644 --- a/tests/isccfg/grammar_test.c +++ b/tests/isccfg/grammar_test.c @@ -115,8 +115,8 @@ test__query_source_print(const char *config, const char *expected) { isc_buffer_constinit(&buffer, config, strlen(config)); isc_buffer_add(&buffer, strlen(config)); - result = cfg_parse_buffer(isc_g_mctx, &buffer, "text1", 0, - &cfg_type_namedconf, 0, &output_conf); + result = cfg_parse_buffer(&buffer, "text1", 0, &cfg_type_namedconf, 0, + &output_conf); assert_int_equal(result, ISC_R_SUCCESS); assert_non_null(output_conf); diff --git a/tests/isccfg/parser_test.c b/tests/isccfg/parser_test.c index e1e6beb093b..d817d3eeaf0 100644 --- a/tests/isccfg/parser_test.c +++ b/tests/isccfg/parser_test.c @@ -79,8 +79,8 @@ ISC_RUN_TEST_IMPL(addzoneconf) { isc_buffer_constinit(&b, tests[i], strlen(tests[i])); isc_buffer_add(&b, strlen(tests[i])); - result = cfg_parse_buffer(isc_g_mctx, &b, "text1", 0, - &cfg_type_namedconf, 0, &conf); + result = cfg_parse_buffer(&b, "text1", 0, &cfg_type_namedconf, + 0, &conf); assert_int_equal(result, ISC_R_SUCCESS); /* @@ -130,22 +130,20 @@ ISC_RUN_TEST_IMPL(parse_buffer) { /* Parse with default line numbering. */ isc_buffer_init(&buf, &text[0], sizeof(text) - 1); isc_buffer_add(&buf, sizeof(text) - 1); - result = cfg_parse_buffer(isc_g_mctx, &buf, "text1", 0, - &cfg_type_namedconf, 0, &c); + result = cfg_parse_buffer(&buf, "text1", 0, &cfg_type_namedconf, 0, &c); assert_int_equal(result, ISC_R_FAILURE); assert_null(c); /* Parse with changed line number. */ isc_buffer_first(&buf); - result = cfg_parse_buffer(isc_g_mctx, &buf, "text2", 100, - &cfg_type_namedconf, 0, &c); + result = cfg_parse_buffer(&buf, "text2", 100, &cfg_type_namedconf, 0, + &c); assert_int_equal(result, ISC_R_FAILURE); assert_null(c); /* Parse with changed line number and no name. */ isc_buffer_first(&buf); - result = cfg_parse_buffer(isc_g_mctx, &buf, NULL, 100, - &cfg_type_namedconf, 0, &c); + result = cfg_parse_buffer(&buf, NULL, 100, &cfg_type_namedconf, 0, &c); assert_int_equal(result, ISC_R_FAILURE); assert_null(c); @@ -262,8 +260,7 @@ view \"_bind\" chaos {\n\ isc_buffer_init(&buf, conf, sizeof(conf)); isc_buffer_add(&buf, sizeof(conf) - 1); - result = cfg_parse_buffer(isc_g_mctx, &buf, "", 0, &cfg_type_namedconf, - 0, &orig); + result = cfg_parse_buffer(&buf, "", 0, &cfg_type_namedconf, 0, &orig); assert_int_equal(result, ISC_R_SUCCESS); isc_buffer_init(&dumpb1, dumpbdata1, sizeof(dumpbdata1));