mirror of
https://github.com/neovim/neovim.git
synced 2025-10-01 07:28:34 +00:00
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:

committed by
Thiago de Arruda

parent
4b6b9117b3
commit
42f1bd9b22
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user