These were broken when using dmalloc due to include file ordering
[oweals/busybox.git] / editors / sed.c
index 73ed058e237fa1a2486bad4d194e74b87d7257f5..89b16682fd30f58fc3948388869900d461003c54 100644 (file)
@@ -195,15 +195,6 @@ static int get_address(struct sed_cmd *sed_cmd, const char *str, int *linenum, r
        return idx;
 }
 
-static char *strdup_substr(const char *str, int start, int end)
-{
-       int size = end - start + 1;
-       char *newstr = xmalloc(size);
-       memcpy(newstr, str+start, size-1);
-       newstr[size-1] = '\0';
-       return newstr;
-}
-
 static int parse_subst_cmd(struct sed_cmd *sed_cmd, const char *substr)
 {
        int oldidx, cflags = REG_NEWLINE;
@@ -608,6 +599,10 @@ static void process_file(FILE *file)
                         * entry point into sedding...
                         */
                        if (
+                                       /* no range necessary */
+                                       (sed_cmds[i].beg_line == 0 && sed_cmds[i].end_line == 0 &&
+                                        sed_cmds[i].beg_match == NULL &&
+                                        sed_cmds[i].end_match == NULL) ||
                                        /* this line number is the first address we're looking for */
                                        (sed_cmds[i].beg_line && (sed_cmds[i].beg_line == linenum)) ||
                                        /* this line matches our first address regex */