summaryrefslogtreecommitdiff
path: root/sed.c
diff options
context:
space:
mode:
authorMark Whitley2000-07-12 23:35:21 +0000
committerMark Whitley2000-07-12 23:35:21 +0000
commitc41e8c840fd6faf802628036c7e5b2683d623c5d (patch)
treec4a47f2e1f1af68d3019f598bada0268f872c1b9 /sed.c
parent6f96e674b9176cafcc25de2a1d79d6f6d7f0e908 (diff)
downloadbusybox-c41e8c840fd6faf802628036c7e5b2683d623c5d.zip
busybox-c41e8c840fd6faf802628036c7e5b2683d623c5d.tar.gz
Changed bb_regcomp to xregcomp and #if 0'ed out destroy_cmd_strs in sed.c
(maybe I'll remove it later).
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 9e4a002..21f8681 100644
--- a/sed.c
+++ b/sed.c
@@ -97,6 +97,7 @@ static const char sed_usage[] =
#endif
;
+#if 0
static void destroy_cmd_strs()
{
if (sed_cmds == NULL)
@@ -125,6 +126,7 @@ static void destroy_cmd_strs()
free(sed_cmds);
sed_cmds = NULL;
}
+#endif
/*
* 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)
fatalError("unterminated match expression\n");
my_str[idx] = '\0';
*regex = (regex_t *)xmalloc(sizeof(regex_t));
- if (bb_regcomp(*regex, my_str+1, REG_NEWLINE) != 0) {
- free(my_str);
- exit(1);
- }
+ xregcomp(*regex, my_str+1, REG_NEWLINE);
}
else {
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)
/* compile the regex */
sed_cmd->sub_match = (regex_t *)xmalloc(sizeof(regex_t));
- if (bb_regcomp(sed_cmd->sub_match, match, cflags) != 0) {
- free(match);
- exit(1);
- }
+ xregcomp(sed_cmd->sub_match, match, cflags);
free(match);
}
}
@@ -460,11 +456,13 @@ extern int sed_main(int argc, char **argv)
if (argv[1] && (strcmp(argv[1], "--help") == 0))
usage(sed_usage);
+#if 0
/* destroy command strings on exit */
if (atexit(destroy_cmd_strs) == -1) {
perror("sed");
exit(1);
}
+#endif
/* do normal option parsing */
while ((opt = getopt(argc, argv, "Vhne:f:")) > 0) {