diff options
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 695e5e974..70b36095f 100644 --- a/editors/sed.c +++ b/editors/sed.c | |||
@@ -168,7 +168,7 @@ static void cleanup_outname(void) | |||
168 | 168 | ||
169 | /* strdup, replacing "\n" with '\n', and "\delimiter" with 'delimiter' */ | 169 | /* strdup, replacing "\n" with '\n', and "\delimiter" with 'delimiter' */ |
170 | 170 | ||
171 | static void parse_escapes(char *dest, char *string, int len, char from, char to) | 171 | static void parse_escapes(char *dest, const char *string, int len, char from, char to) |
172 | { | 172 | { |
173 | int i = 0; | 173 | int i = 0; |
174 | 174 | ||
@@ -186,7 +186,7 @@ static void parse_escapes(char *dest, char *string, int len, char from, char to) | |||
186 | *dest = 0; | 186 | *dest = 0; |
187 | } | 187 | } |
188 | 188 | ||
189 | static char *copy_parsing_escapes(char *string, int len) | 189 | static char *copy_parsing_escapes(const char *string, int len) |
190 | { | 190 | { |
191 | char *dest = xmalloc(len + 1); | 191 | char *dest = xmalloc(len + 1); |
192 | 192 | ||
@@ -201,7 +201,7 @@ static char *copy_parsing_escapes(char *string, int len) | |||
201 | * expression delimiter (typically a forward * slash ('/')) not preceded by | 201 | * expression delimiter (typically a forward * slash ('/')) not preceded by |
202 | * a backslash ('\'). A negative delimiter disables square bracket checking. | 202 | * a backslash ('\'). A negative delimiter disables square bracket checking. |
203 | */ | 203 | */ |
204 | static int index_of_next_unescaped_regexp_delim(int delimiter, char *str) | 204 | static int index_of_next_unescaped_regexp_delim(int delimiter, const char *str) |
205 | { | 205 | { |
206 | int bracket = -1; | 206 | int bracket = -1; |
207 | int escaped = 0; | 207 | int escaped = 0; |
@@ -262,12 +262,12 @@ static int parse_regex_delim(char *cmdstr, char **match, char **replace) | |||
262 | /* | 262 | /* |
263 | * returns the index in the string just past where the address ends. | 263 | * returns the index in the string just past where the address ends. |
264 | */ | 264 | */ |
265 | static int get_address(char *my_str, int *linenum, regex_t ** regex) | 265 | static int get_address(const char *my_str, int *linenum, regex_t ** regex) |
266 | { | 266 | { |
267 | char *pos = my_str; | 267 | const char *pos = my_str; |
268 | 268 | ||
269 | if (isdigit(*my_str)) { | 269 | if (isdigit(*my_str)) { |
270 | *linenum = strtol(my_str, &pos, 10); | 270 | *linenum = strtol(my_str, (char**)&pos, 10); |
271 | /* endstr shouldnt ever equal NULL */ | 271 | /* endstr shouldnt ever equal NULL */ |
272 | } else if (*my_str == '$') { | 272 | } else if (*my_str == '$') { |
273 | *linenum = -1; | 273 | *linenum = -1; |
@@ -314,7 +314,7 @@ static int parse_subst_cmd(sed_cmd_t *sed_cmd, char *substr) | |||
314 | { | 314 | { |
315 | int cflags = bbg.regex_type; | 315 | int cflags = bbg.regex_type; |
316 | char *match; | 316 | char *match; |
317 | int idx = 0; | 317 | int idx; |
318 | 318 | ||
319 | /* | 319 | /* |
320 | * A substitution command should look something like this: | 320 | * A substitution command should look something like this: |
@@ -469,16 +469,16 @@ static char *parse_cmd_args(sed_cmd_t *sed_cmd, char *cmdstr) | |||
469 | 469 | ||
470 | /* Parse address+command sets, skipping comment lines. */ | 470 | /* Parse address+command sets, skipping comment lines. */ |
471 | 471 | ||
472 | static void add_cmd(char *cmdstr) | 472 | static void add_cmd(const char *cmdstr) |
473 | { | 473 | { |
474 | sed_cmd_t *sed_cmd; | 474 | sed_cmd_t *sed_cmd; |
475 | int temp; | 475 | int temp; |
476 | 476 | ||
477 | /* Append this line to any unfinished line from last time. */ | 477 | /* Append this line to any unfinished line from last time. */ |
478 | if (bbg.add_cmd_line) { | 478 | if (bbg.add_cmd_line) { |
479 | cmdstr = xasprintf("%s\n%s", bbg.add_cmd_line, cmdstr); | 479 | char *tp = xasprintf("%s\n%s", bbg.add_cmd_line, cmdstr); |
480 | free(bbg.add_cmd_line); | 480 | free(bbg.add_cmd_line); |
481 | bbg.add_cmd_line = cmdstr; | 481 | bbg.add_cmd_line = tp; |
482 | } | 482 | } |
483 | 483 | ||
484 | /* If this line ends with backslash, request next line. */ | 484 | /* If this line ends with backslash, request next line. */ |