>From f33e0ef28ab33110c361ba0a9698dbc71243c1fb Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Sat, 3 Oct 2026 11:46:20 +0000 Subject: [PATCH 08/25] regex: remove unused code from tre_add_tags saved_states seems to be unused. even in earliest tre version. drop it. --- src/regex/regcomp.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/src/regex/regcomp.c b/src/regex/regcomp.c index 307a22b3..01084eb1 100644 --- a/src/regex/regcomp.c +++ b/src/regex/regcomp.c @@ -1168,12 +1168,6 @@ typedef enum { } tre_addtags_symbol_t; -typedef struct { - int tag; - int next_tag; -} tre_tag_states_t; - - /* Go through `regset' and set submatch data for submatches that are using this tag. */ static void @@ -1213,7 +1207,6 @@ tre_add_tags(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *tree, int next_tag = 1; /* Next tag to use after this one. */ int parent = 0; /* Current node is within this submatch. */ int minimal_tag = -1; /* Tag that marks the beginning of a minimal match. */ - tre_tag_states_t *saved_states; tre_tag_direction_t direction = TRE_TAG_MINIMIZE; if (!first_pass) @@ -1228,19 +1221,6 @@ tre_add_tags(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *tree, regset[0] = -1; orig_regset = regset; - saved_states = xmalloc(sizeof(*saved_states) * (tnfa->num_submatches + 1)); - if (saved_states == NULL) - { - xfree(regset); - return REG_ESPACE; - } - else - { - unsigned int i; - for (i = 0; i <= tnfa->num_submatches; i++) - saved_states[i].tag = -1; - } - STACK_PUSH(stack, voidptr, node); STACK_PUSH(stack, int, ADDTAGS_RECURSE); @@ -1637,7 +1617,6 @@ tre_add_tags(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *tree, tnfa->num_tags = num_tags; tnfa->num_minimals = num_minimals; xfree(orig_regset); - xfree(saved_states); return status; } -- 2.52.0