diff --git a/src/lib66/parse/parse_get_section.c b/src/lib66/parse/parse_get_section.c index 683f9ade4fa0e598f6ca4a8a836649f055a29aa9..ed18efe63d7fdb3fee7b3d051b16265a7eb94aa2 100644 --- a/src/lib66/parse/parse_get_section.c +++ b/src/lib66/parse/parse_get_section.c @@ -37,12 +37,9 @@ int parse_get_section(lexer_config *acfg, unsigned int *ncfg, char const *str, s cfg.pos = pos ; stack_reset(&stk) ; - if (!lexer(&stk, &cfg)) + if (!lexer(&stk, &cfg) || !stack_close(&stk)) return 0 ; - if (!stack_close(&stk)) - log_warnu_return(LOG_EXIT_ZERO, "stack overflow") ; - if (cfg.found) { ssize_t id = get_enum_by_key(stk.s) ; diff --git a/src/lib66/parse/parse_key.c b/src/lib66/parse/parse_key.c index 27b240cbe424d10e819d7777e619e24d97eac30d..45de9386c664cc1e6e9505c799f3093d083281d9 100644 --- a/src/lib66/parse/parse_key.c +++ b/src/lib66/parse/parse_key.c @@ -24,12 +24,9 @@ int parse_key(stack *key, lexer_config *cfg) { int kid = -1, next = -1 ; - if (!lexer(key, cfg)) + if (!lexer(key, cfg) || !stack_close(key)) return -1 ; - if (!stack_close(key)) - log_warnu_return(LOG_EXIT_LESSONE, "stack overflow") ; - if (cfg->found) { kid = get_enum_by_key(key->s) ; diff --git a/src/lib66/parse/parse_list.c b/src/lib66/parse/parse_list.c index 7fdd9dda4b16d333653149efeb67d02b7172ecd3..3e73151083edf1d104c1b6bfdaa40d294776b1b6 100644 --- a/src/lib66/parse/parse_list.c +++ b/src/lib66/parse/parse_list.c @@ -28,19 +28,9 @@ int parse_list(stack *stk) if (!stack_copy_stack(&tmp, stk)) return 0 ; - cfg.str = tmp.s ; cfg.slen = tmp.len ; - stk->len = 0 ; stk->count = 0 ; + stack_reset(stk) ; - while (cfg.pos < cfg.slen) { - - lexer_reset(&cfg) ; - cfg.opos = 0 ; - cfg.cpos = 0 ; - if (!lexer(stk, &cfg)) - return 0 ; - } - - if (!stack_close(stk)) + if (!lexer_trim_with_g(stk, tmp.s, &cfg)) return 0 ; return 1 ;