diff --git a/bin/named/control.c b/bin/named/control.c index 8f2e1f0678..7186358793 100644 --- a/bin/named/control.c +++ b/bin/named/control.c @@ -97,10 +97,7 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly, return (result); } - result = isc_lex_create(named_g_mctx, strlen(cmdline), &lex); - if (result != ISC_R_SUCCESS) { - return (result); - } + isc_lex_create(named_g_mctx, strlen(cmdline), &lex); isc_buffer_init(&src, cmdline, strlen(cmdline)); isc_buffer_add(&src, strlen(cmdline)); diff --git a/bin/nsupdate/nsupdate.c b/bin/nsupdate/nsupdate.c index 205a962eb4..f939281bf3 100644 --- a/bin/nsupdate/nsupdate.c +++ b/bin/nsupdate/nsupdate.c @@ -1377,8 +1377,7 @@ parse_rdata(char **cmdlinep, dns_rdataclass_t rdataclass, if (*cmdline != 0) { dns_rdatacallbacks_init(&callbacks); - result = isc_lex_create(gmctx, strlen(cmdline), &lex); - check_result(result, "isc_lex_create"); + isc_lex_create(gmctx, strlen(cmdline), &lex); isc_buffer_init(&source, cmdline, strlen(cmdline)); isc_buffer_add(&source, strlen(cmdline)); result = isc_lex_openbuffer(lex, &source); diff --git a/bin/tools/named-rrchecker.c b/bin/tools/named-rrchecker.c index 2ea0ef48e4..ce4a948343 100644 --- a/bin/tools/named-rrchecker.c +++ b/bin/tools/named-rrchecker.c @@ -157,7 +157,7 @@ main(int argc, char *argv[]) { } isc_mem_create(&mctx); - RUNTIME_CHECK(isc_lex_create(mctx, 256, &lex) == ISC_R_SUCCESS); + isc_lex_create(mctx, 256, &lex); /* * Set up to lex DNS master file. diff --git a/fuzz/dns_rdata_fromtext.c b/fuzz/dns_rdata_fromtext.c index b52a18f276..03ec0935c5 100644 --- a/fuzz/dns_rdata_fromtext.c +++ b/fuzz/dns_rdata_fromtext.c @@ -69,7 +69,7 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { isc_buffer_add(&inbuf, size); isc_buffer_setactive(&inbuf, size); - RUNTIME_CHECK(isc_lex_create(mctx, 256, &lex) == ISC_R_SUCCESS); + isc_lex_create(mctx, 256, &lex); /* * Set up to lex DNS master file. diff --git a/fuzz/dns_rdata_fromwire_text.c b/fuzz/dns_rdata_fromwire_text.c index d42dc543d4..67f3ce3830 100644 --- a/fuzz/dns_rdata_fromwire_text.c +++ b/fuzz/dns_rdata_fromwire_text.c @@ -47,7 +47,7 @@ LLVMFuzzerInitialize(int *argc __attribute__((unused)), isc_lexspecials_t specials; isc_mem_create(&mctx); - CHECK(isc_lex_create(mctx, 64, &lex)); + isc_lex_create(mctx, 64, &lex); memset(specials, 0, sizeof(specials)); specials[0] = 1; diff --git a/fuzz/isc_lex_getmastertoken.c b/fuzz/isc_lex_getmastertoken.c index 5931e1814f..1967bfb493 100644 --- a/fuzz/isc_lex_getmastertoken.c +++ b/fuzz/isc_lex_getmastertoken.c @@ -37,12 +37,8 @@ static isc_lex_t *lex = NULL; int LLVMFuzzerInitialize(int *argc __attribute__((unused)), char ***argv __attribute__((unused))) { - isc_result_t result; - isc_mem_create(&mctx); - - result = isc_lex_create(mctx, 1024, &lex); - REQUIRE(result == ISC_R_SUCCESS); + isc_lex_create(mctx, 1024, &lex); return (0); } diff --git a/fuzz/isc_lex_gettoken.c b/fuzz/isc_lex_gettoken.c index c295145e42..c98d5138e2 100644 --- a/fuzz/isc_lex_gettoken.c +++ b/fuzz/isc_lex_gettoken.c @@ -29,12 +29,8 @@ static isc_lex_t *lex = NULL; int LLVMFuzzerInitialize(int *argc __attribute__((unused)), char ***argv __attribute__((unused))) { - isc_result_t result; - isc_mem_create(&mctx); - - result = isc_lex_create(mctx, 1024, &lex); - REQUIRE(result == ISC_R_SUCCESS); + isc_lex_create(mctx, 1024, &lex); return (0); } diff --git a/lib/dns/dst_api.c b/lib/dns/dst_api.c index b844a82d58..14a1c7e4a8 100644 --- a/lib/dns/dst_api.c +++ b/lib/dns/dst_api.c @@ -663,7 +663,7 @@ dst_key_fromnamedfile(const char *filename, const char *dirname, int type, ".private"); INSIST(result == ISC_R_SUCCESS); - RETERR(isc_lex_create(mctx, 1500, &lex)); + isc_lex_create(mctx, 1500, &lex); RETERR(isc_lex_openfile(lex, newfilename)); isc_mem_put(mctx, newfilename, newfilenamelen); @@ -843,7 +843,7 @@ dst_key_privatefrombuffer(dst_key_t *key, isc_buffer_t *buffer) { RETERR(DST_R_UNSUPPORTEDALG); } - RETERR(isc_lex_create(key->mctx, 1500, &lex)); + isc_lex_create(key->mctx, 1500, &lex); RETERR(isc_lex_openbuffer(lex, buffer)); RETERR(key->func->parse(key, lex, NULL)); out: @@ -1587,10 +1587,7 @@ dst_key_read_public(const char *filename, int type, isc_mem_t *mctx, */ /* 1500 should be large enough for any key */ - ret = isc_lex_create(mctx, 1500, &lex); - if (ret != ISC_R_SUCCESS) { - goto cleanup; - } + isc_lex_create(mctx, 1500, &lex); memset(specials, 0, sizeof(specials)); specials['('] = 1; @@ -1740,10 +1737,7 @@ dst_key_read_state(const char *filename, isc_mem_t *mctx, dst_key_t **keyp) { isc_result_t ret; unsigned int opt = ISC_LEXOPT_EOL; - ret = isc_lex_create(mctx, 1500, &lex); - if (ret != ISC_R_SUCCESS) { - goto cleanup; - } + isc_lex_create(mctx, 1500, &lex); isc_lex_setcomments(lex, ISC_LEXCOMMENT_DNSMASTERFILE); ret = isc_lex_openfile(lex, filename); diff --git a/lib/dns/master.c b/lib/dns/master.c index b433f146c8..8821d37248 100644 --- a/lib/dns/master.c +++ b/lib/dns/master.c @@ -547,10 +547,7 @@ loadctx_create(dns_masterformat_t format, isc_mem_t *mctx, unsigned int options, lctx->keep_lex = true; } else { lctx->lex = NULL; - result = isc_lex_create(mctx, TOKENSIZ, &lctx->lex); - if (result != ISC_R_SUCCESS) { - goto cleanup_inc; - } + isc_lex_create(mctx, TOKENSIZ, &lctx->lex); lctx->keep_lex = false; /* * If specials change update dns_test_rdatafromstring() @@ -607,8 +604,6 @@ loadctx_create(dns_masterformat_t format, isc_mem_t *mctx, unsigned int options, *lctxp = lctx; return (ISC_R_SUCCESS); -cleanup_inc: - incctx_destroy(mctx, lctx->inc); cleanup_ctx: isc_mem_put(mctx, lctx, sizeof(*lctx)); return (result); diff --git a/lib/dns/sdb.c b/lib/dns/sdb.c index 7399d7a053..c5915a7444 100644 --- a/lib/dns/sdb.c +++ b/lib/dns/sdb.c @@ -351,10 +351,7 @@ dns_sdb_putrr(dns_sdblookup_t *lookup, const char *type, dns_ttl_t ttl, origin = dns_rootname; } - result = isc_lex_create(mctx, 64, &lex); - if (result != ISC_R_SUCCESS) { - goto failure; - } + isc_lex_create(mctx, 64, &lex); datalen = strlen(data); size = initial_size(datalen); diff --git a/lib/dns/sdlz.c b/lib/dns/sdlz.c index a982078ab9..26ba3833aa 100644 --- a/lib/dns/sdlz.c +++ b/lib/dns/sdlz.c @@ -1816,10 +1816,7 @@ dns_sdlz_putrr(dns_sdlzlookup_t *lookup, const char *type, dns_ttl_t ttl, } lex = NULL; - result = isc_lex_create(mctx, 64, &lex); - if (result != ISC_R_SUCCESS) { - goto failure; - } + isc_lex_create(mctx, 64, &lex); size = initial_size(data); do { diff --git a/lib/dns/view.c b/lib/dns/view.c index 22f43f757a..38fb06a665 100644 --- a/lib/dns/view.c +++ b/lib/dns/view.c @@ -2165,7 +2165,7 @@ dns_view_loadnta(dns_view_t *view) { return (ISC_R_SUCCESS); } - CHECK(isc_lex_create(view->mctx, 1025, &lex)); + isc_lex_create(view->mctx, 1025, &lex); CHECK(isc_lex_openfile(lex, view->nta_file)); CHECK(dns_view_getntatable(view, &ntatable)); isc_stdtime_get(&now); diff --git a/lib/isc/include/isc/lex.h b/lib/isc/include/isc/lex.h index 14b29cf94d..2579ea4647 100644 --- a/lib/isc/include/isc/lex.h +++ b/lib/isc/include/isc/lex.h @@ -142,7 +142,7 @@ typedef struct isc_token { *** Functions ***/ -isc_result_t +void isc_lex_create(isc_mem_t *mctx, size_t max_token, isc_lex_t **lexp); /*%< * Create a lexer. diff --git a/lib/isc/lex.c b/lib/isc/lex.c index 63b9b79d34..61476808ed 100644 --- a/lib/isc/lex.c +++ b/lib/isc/lex.c @@ -82,7 +82,7 @@ grow_data(isc_lex_t *lex, size_t *remainingp, char **currp, char **prevp) { return (ISC_R_SUCCESS); } -isc_result_t +void isc_lex_create(isc_mem_t *mctx, size_t max_token, isc_lex_t **lexp) { isc_lex_t *lex; @@ -110,8 +110,6 @@ isc_lex_create(isc_mem_t *mctx, size_t max_token, isc_lex_t **lexp) { lex->magic = LEX_MAGIC; *lexp = lex; - - return (ISC_R_SUCCESS); } void diff --git a/lib/isccfg/parser.c b/lib/isccfg/parser.c index e35b4e7f3b..140bdfc7b3 100644 --- a/lib/isccfg/parser.c +++ b/lib/isccfg/parser.c @@ -530,7 +530,7 @@ cfg_parser_create(isc_mem_t *mctx, isc_log_t *lctx, cfg_parser_t **ret) { specials['"'] = 1; specials['!'] = 1; - CHECK(isc_lex_create(pctx->mctx, 1024, &pctx->lexer)); + isc_lex_create(pctx->mctx, 1024, &pctx->lexer); isc_lex_setspecials(pctx->lexer, specials); isc_lex_setcomments(pctx->lexer, diff --git a/tests/isc/lex_test.c b/tests/isc/lex_test.c index 48c7915f5c..538e135982 100644 --- a/tests/isc/lex_test.c +++ b/tests/isc/lex_test.c @@ -42,8 +42,7 @@ ISC_RUN_TEST_IMPL(lex_0xff) { UNUSED(state); - result = isc_lex_create(mctx, 1024, &lex); - assert_int_equal(result, ISC_R_SUCCESS); + isc_lex_create(mctx, 1024, &lex); isc_buffer_init(&death_buf, &death[0], sizeof(death)); isc_buffer_add(&death_buf, sizeof(death)); @@ -69,8 +68,7 @@ ISC_RUN_TEST_IMPL(lex_setline) { UNUSED(state); - result = isc_lex_create(mctx, 1024, &lex); - assert_int_equal(result, ISC_R_SUCCESS); + isc_lex_create(mctx, 1024, &lex); isc_buffer_init(&buf, &text[0], sizeof(text)); isc_buffer_add(&buf, sizeof(text)); @@ -192,8 +190,7 @@ ISC_RUN_TEST_IMPL(lex_string) { UNUSED(state); for (i = 0; i < ARRAY_SIZE(parse_tests); i++) { - result = isc_lex_create(mctx, 1024, &lex); - assert_int_equal(result, ISC_R_SUCCESS); + isc_lex_create(mctx, 1024, &lex); isc_buffer_constinit(&buf, parse_tests[i].text, strlen(parse_tests[i].text)); @@ -246,8 +243,7 @@ ISC_RUN_TEST_IMPL(lex_qstring) { UNUSED(state); for (i = 0; i < ARRAY_SIZE(parse_tests); i++) { - result = isc_lex_create(mctx, 1024, &lex); - assert_int_equal(result, ISC_R_SUCCESS); + isc_lex_create(mctx, 1024, &lex); isc_buffer_constinit(&buf, parse_tests[i].text, strlen(parse_tests[i].text)); @@ -301,8 +297,7 @@ ISC_RUN_TEST_IMPL(lex_keypair) { UNUSED(state); for (i = 0; i < ARRAY_SIZE(parse_tests); i++) { - result = isc_lex_create(mctx, 1024, &lex); - assert_int_equal(result, ISC_R_SUCCESS); + isc_lex_create(mctx, 1024, &lex); isc_buffer_constinit(&buf, parse_tests[i].text, strlen(parse_tests[i].text)); diff --git a/tests/libtest/dns.c b/tests/libtest/dns.c index ec3dd1e5f9..c292106ae6 100644 --- a/tests/libtest/dns.c +++ b/tests/libtest/dns.c @@ -352,10 +352,7 @@ dns_test_rdatafromstring(dns_rdata_t *rdata, dns_rdataclass_t rdclass, /* * Create a lexer as one is required by dns_rdata_fromtext(). */ - result = isc_lex_create(mctx, 64, &lex); - if (result != ISC_R_SUCCESS) { - return (result); - } + isc_lex_create(mctx, 64, &lex); /* * Set characters which will be treated as valid multi-line RDATA