mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-25 02:47:54 -04:00
Merge branch 'ondrej-cleanup-isc_lex_create' into 'main'
Change the return type of isc_lex_create() to void See merge request isc-projects/bind9!6983
This commit is contained in:
commit
e004ca4f6c
17 changed files with 24 additions and 63 deletions
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue