aboutsummaryrefslogtreecommitdiff
path: root/sed.c
diff options
context:
space:
mode:
Diffstat (limited to 'sed.c')
-rw-r--r--sed.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/sed.c b/sed.c
index 9e4a002d8..21f868167 100644
--- a/sed.c
+++ b/sed.c
@@ -97,6 +97,7 @@ static const char sed_usage[] =
97#endif 97#endif
98 ; 98 ;
99 99
100#if 0
100static void destroy_cmd_strs() 101static void destroy_cmd_strs()
101{ 102{
102 if (sed_cmds == NULL) 103 if (sed_cmds == NULL)
@@ -125,6 +126,7 @@ static void destroy_cmd_strs()
125 free(sed_cmds); 126 free(sed_cmds);
126 sed_cmds = NULL; 127 sed_cmds = NULL;
127} 128}
129#endif
128 130
129/* 131/*
130 * trim_str - trims leading and trailing space from a string 132 * trim_str - trims leading and trailing space from a string
@@ -199,10 +201,7 @@ static int get_address(const char *str, int *line, regex_t **regex)
199 fatalError("unterminated match expression\n"); 201 fatalError("unterminated match expression\n");
200 my_str[idx] = '\0'; 202 my_str[idx] = '\0';
201 *regex = (regex_t *)xmalloc(sizeof(regex_t)); 203 *regex = (regex_t *)xmalloc(sizeof(regex_t));
202 if (bb_regcomp(*regex, my_str+1, REG_NEWLINE) != 0) { 204 xregcomp(*regex, my_str+1, REG_NEWLINE);
203 free(my_str);
204 exit(1);
205 }
206 } 205 }
207 else { 206 else {
208 fprintf(stderr, "sed.c:get_address: no address found in string\n"); 207 fprintf(stderr, "sed.c:get_address: no address found in string\n");
@@ -291,10 +290,7 @@ static void parse_cmd_str(struct sed_cmd *sed_cmd, const char *cmdstr)
291 290
292 /* compile the regex */ 291 /* compile the regex */
293 sed_cmd->sub_match = (regex_t *)xmalloc(sizeof(regex_t)); 292 sed_cmd->sub_match = (regex_t *)xmalloc(sizeof(regex_t));
294 if (bb_regcomp(sed_cmd->sub_match, match, cflags) != 0) { 293 xregcomp(sed_cmd->sub_match, match, cflags);
295 free(match);
296 exit(1);
297 }
298 free(match); 294 free(match);
299 } 295 }
300} 296}
@@ -460,11 +456,13 @@ extern int sed_main(int argc, char **argv)
460 if (argv[1] && (strcmp(argv[1], "--help") == 0)) 456 if (argv[1] && (strcmp(argv[1], "--help") == 0))
461 usage(sed_usage); 457 usage(sed_usage);
462 458
459#if 0
463 /* destroy command strings on exit */ 460 /* destroy command strings on exit */
464 if (atexit(destroy_cmd_strs) == -1) { 461 if (atexit(destroy_cmd_strs) == -1) {
465 perror("sed"); 462 perror("sed");
466 exit(1); 463 exit(1);
467 } 464 }
465#endif
468 466
469 /* do normal option parsing */ 467 /* do normal option parsing */
470 while ((opt = getopt(argc, argv, "Vhne:f:")) > 0) { 468 while ((opt = getopt(argc, argv, "Vhne:f:")) > 0) {