make sed cleanup use linked list
This commit is contained in:
parent
c949bfa555
commit
56c633c139
@ -118,30 +118,27 @@ const char * const semicolon_whitespace = "; \n\r\t\v\0";
|
|||||||
#ifdef CONFIG_FEATURE_CLEAN_UP
|
#ifdef CONFIG_FEATURE_CLEAN_UP
|
||||||
static void destroy_cmd_strs(void)
|
static void destroy_cmd_strs(void)
|
||||||
{
|
{
|
||||||
if (sed_cmds == NULL)
|
sed_cmd_t *sed_cmd = sed_cmd_head.linear;
|
||||||
return;
|
|
||||||
|
|
||||||
/* destroy all the elements in the array */
|
while (sed_cmd) {
|
||||||
while (--ncmds >= 0) {
|
sed_cmd_t *sed_cmd_next = sed_cmd->linear;
|
||||||
|
|
||||||
if (sed_cmds[ncmds]->beg_match) {
|
if (sed_cmd->beg_match) {
|
||||||
regfree(sed_cmds[ncmds]->beg_match);
|
regfree(sed_cmd->beg_match);
|
||||||
free(sed_cmds[ncmds]->beg_match);
|
free(sed_cmd->beg_match);
|
||||||
}
|
}
|
||||||
if (sed_cmds[ncmds]->end_match) {
|
if (sed_cmd->end_match) {
|
||||||
regfree(sed_cmds[ncmds]->end_match);
|
regfree(sed_cmd->end_match);
|
||||||
free(sed_cmds[ncmds]->end_match);
|
free(sed_cmd->end_match);
|
||||||
}
|
}
|
||||||
if (sed_cmds[ncmds]->sub_match) {
|
if (sed_cmd->sub_match) {
|
||||||
regfree(sed_cmds[ncmds]->sub_match);
|
regfree(sed_cmd->sub_match);
|
||||||
free(sed_cmds[ncmds]->sub_match);
|
free(sed_cmd->sub_match);
|
||||||
}
|
}
|
||||||
free(sed_cmds[ncmds]->replace);
|
free(sed_cmd->replace);
|
||||||
|
free(sed_cmd);
|
||||||
|
sed_cmd = sed_cmd_next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* destroy the array */
|
|
||||||
free(sed_cmds);
|
|
||||||
sed_cmds = NULL;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user