No OOM error condition in ga_concat_strings(), concat_fnames(), concat_str()

- xmallocz() is not static anymore. There are many use cases for this function
	 in the codebase and we should start using it.
 - Simpler types in ga_concat_strings()
This commit is contained in:
Felipe Oliveira Carvalho
2014-04-19 02:12:47 -03:00
committed by Thiago de Arruda
parent 4b6b9117b3
commit 42f1bd9b22
10 changed files with 54 additions and 97 deletions

View File

@@ -4020,22 +4020,14 @@ void do_sub(exarg_T *eap)
orig_line = vim_strsave(ml_get(lnum));
if (orig_line != NULL) {
char_u *new_line = concat_str(new_start,
sub_firstline + copycol);
sub_firstline + copycol);
if (new_line == NULL) {
vim_free(orig_line);
orig_line = NULL;
} else {
/* Position the cursor relative to the
* end of the line, the previous
* substitute may have inserted or
* deleted characters before the
* cursor. */
len_change = (int)STRLEN(new_line)
- (int)STRLEN(orig_line);
curwin->w_cursor.col += len_change;
ml_replace(lnum, new_line, FALSE);
}
// Position the cursor relative to the end of the line, the
// previous substitute may have inserted or deleted characters
// before the cursor.
len_change = (int)STRLEN(new_line) - (int)STRLEN(orig_line);
curwin->w_cursor.col += len_change;
ml_replace(lnum, new_line, FALSE);
}
}