diff options
author | Denis Vlasenko | 2007-01-29 22:51:25 +0000 |
---|---|---|
committer | Denis Vlasenko | 2007-01-29 22:51:25 +0000 |
commit | b6aae0f38194cd39960a898606ee65d4be93a895 (patch) | |
tree | b73c92aefaf614291a71d05e9d28ca68f4ef021b /editors | |
parent | a41fdf331af344ecd3ec230a072857ea197e1890 (diff) | |
download | busybox-b6aae0f38194cd39960a898606ee65d4be93a895.zip busybox-b6aae0f38194cd39960a898606ee65d4be93a895.tar.gz |
preparatory patch for -Wwrite-strings #2
Diffstat (limited to 'editors')
-rw-r--r-- | editors/sed.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/editors/sed.c b/editors/sed.c index 695e5e9..70b3609 100644 --- a/editors/sed.c +++ b/editors/sed.c @@ -168,7 +168,7 @@ static void cleanup_outname(void) /* strdup, replacing "\n" with '\n', and "\delimiter" with 'delimiter' */ -static void parse_escapes(char *dest, char *string, int len, char from, char to) +static void parse_escapes(char *dest, const char *string, int len, char from, char to) { int i = 0; @@ -186,7 +186,7 @@ static void parse_escapes(char *dest, char *string, int len, char from, char to) *dest = 0; } -static char *copy_parsing_escapes(char *string, int len) +static char *copy_parsing_escapes(const char *string, int len) { char *dest = xmalloc(len + 1); @@ -201,7 +201,7 @@ static char *copy_parsing_escapes(char *string, int len) * expression delimiter (typically a forward * slash ('/')) not preceded by * a backslash ('\'). A negative delimiter disables square bracket checking. */ -static int index_of_next_unescaped_regexp_delim(int delimiter, char *str) +static int index_of_next_unescaped_regexp_delim(int delimiter, const char *str) { int bracket = -1; int escaped = 0; @@ -262,12 +262,12 @@ static int parse_regex_delim(char *cmdstr, char **match, char **replace) /* * returns the index in the string just past where the address ends. */ -static int get_address(char *my_str, int *linenum, regex_t ** regex) +static int get_address(const char *my_str, int *linenum, regex_t ** regex) { - char *pos = my_str; + const char *pos = my_str; if (isdigit(*my_str)) { - *linenum = strtol(my_str, &pos, 10); + *linenum = strtol(my_str, (char**)&pos, 10); /* endstr shouldnt ever equal NULL */ } else if (*my_str == '$') { *linenum = -1; @@ -314,7 +314,7 @@ static int parse_subst_cmd(sed_cmd_t *sed_cmd, char *substr) { int cflags = bbg.regex_type; char *match; - int idx = 0; + int idx; /* * A substitution command should look something like this: @@ -469,16 +469,16 @@ static char *parse_cmd_args(sed_cmd_t *sed_cmd, char *cmdstr) /* Parse address+command sets, skipping comment lines. */ -static void add_cmd(char *cmdstr) +static void add_cmd(const char *cmdstr) { sed_cmd_t *sed_cmd; int temp; /* Append this line to any unfinished line from last time. */ if (bbg.add_cmd_line) { - cmdstr = xasprintf("%s\n%s", bbg.add_cmd_line, cmdstr); + char *tp = xasprintf("%s\n%s", bbg.add_cmd_line, cmdstr); free(bbg.add_cmd_line); - bbg.add_cmd_line = cmdstr; + bbg.add_cmd_line = tp; } /* If this line ends with backslash, request next line. */ |