aboutsummaryrefslogtreecommitdiff
path: root/src/ex_cmds.c
diff options
context:
space:
mode:
authorFelipe Oliveira Carvalho <felipekde@gmail.com>2014-04-19 02:12:47 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-04-24 10:31:31 -0300
commit42f1bd9b2228aaca4fb8a5597a3b5774f7ef6876 (patch)
tree8c056bd42ec55f2103d65af680a54bd55dc71d7f /src/ex_cmds.c
parent4b6b9117b3e8b9b624c354a703f01f0980c60946 (diff)
downloadrneovim-42f1bd9b2228aaca4fb8a5597a3b5774f7ef6876.tar.gz
rneovim-42f1bd9b2228aaca4fb8a5597a3b5774f7ef6876.tar.bz2
rneovim-42f1bd9b2228aaca4fb8a5597a3b5774f7ef6876.zip
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()
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r--src/ex_cmds.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index e2ea0a9625..e6897d0022 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -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);
-
- 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);
- }
+ sub_firstline + copycol);
+
+ // 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);
}
}