[BusyBox-cvs] busybox/editors sed.c,1.109,1.110
Glenn McGrath
bug1 at busybox.net
Fri Mar 28 04:23:26 UTC 2003
Update of /var/cvs/busybox/editors
In directory winder:/tmp/cvs-serv23264/editors
Modified Files:
sed.c
Log Message:
make sed cleanup use linked list
Index: sed.c
===================================================================
RCS file: /var/cvs/busybox/editors/sed.c,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -d -r1.109 -r1.110
--- sed.c 28 Mar 2003 03:53:31 -0000 1.109
+++ sed.c 28 Mar 2003 04:23:23 -0000 1.110
@@ -118,30 +118,27 @@
#ifdef CONFIG_FEATURE_CLEAN_UP
static void destroy_cmd_strs(void)
{
- if (sed_cmds == NULL)
- return;
+ sed_cmd_t *sed_cmd = sed_cmd_head.linear;
- /* destroy all the elements in the array */
- while (--ncmds >= 0) {
+ while (sed_cmd) {
+ sed_cmd_t *sed_cmd_next = sed_cmd->linear;
- if (sed_cmds[ncmds]->beg_match) {
- regfree(sed_cmds[ncmds]->beg_match);
- free(sed_cmds[ncmds]->beg_match);
+ if (sed_cmd->beg_match) {
+ regfree(sed_cmd->beg_match);
+ free(sed_cmd->beg_match);
}
- if (sed_cmds[ncmds]->end_match) {
- regfree(sed_cmds[ncmds]->end_match);
- free(sed_cmds[ncmds]->end_match);
+ if (sed_cmd->end_match) {
+ regfree(sed_cmd->end_match);
+ free(sed_cmd->end_match);
}
- if (sed_cmds[ncmds]->sub_match) {
- regfree(sed_cmds[ncmds]->sub_match);
- free(sed_cmds[ncmds]->sub_match);
+ if (sed_cmd->sub_match) {
+ regfree(sed_cmd->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
More information about the busybox-cvs
mailing list