aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_cmds.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-05-25 14:49:43 +0200
committerGitHub <noreply@github.com>2019-05-25 14:49:43 +0200
commit2f023f40b275a904c96d5b287e9e9abe6df1aec7 (patch)
tree36f2b5bec81f7144c5bd3787f33959bd60c59e0e /src/nvim/ex_cmds.c
parent4769deb36a54c3b2a4a2d2addb2937c1aa7dd629 (diff)
parenteddd1bff3e7bf8df7405f6b0bfd01a5bb8ba20a9 (diff)
downloadrneovim-2f023f40b275a904c96d5b287e9e9abe6df1aec7.tar.gz
rneovim-2f023f40b275a904c96d5b287e9e9abe6df1aec7.tar.bz2
rneovim-2f023f40b275a904c96d5b287e9e9abe6df1aec7.zip
Merge #10046 from justinmk/xfree
refactor: introduce XFREE_CLEAR()
Diffstat (limited to 'src/nvim/ex_cmds.c')
-rw-r--r--src/nvim/ex_cmds.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index b3933ac9a6..e7f4736613 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -3526,8 +3526,7 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout,
lnum += regmatch.startpos[0].lnum;
sub_firstlnum += regmatch.startpos[0].lnum;
nmatch -= regmatch.startpos[0].lnum;
- xfree(sub_firstline);
- sub_firstline = NULL;
+ XFREE_CLEAR(sub_firstline);
}
// Now we're at the line where the pattern match starts
@@ -4058,11 +4057,11 @@ skip:
line_breakcheck();
}
- if (did_sub)
- ++sub_nlines;
- xfree(new_start); /* for when substitute was cancelled */
- xfree(sub_firstline); /* free the copy of the original line */
- sub_firstline = NULL;
+ if (did_sub) {
+ sub_nlines++;
+ }
+ xfree(new_start); // for when substitute was cancelled
+ XFREE_CLEAR(sub_firstline); // free the copy of the original line
}
line_breakcheck();
@@ -5077,9 +5076,8 @@ void fix_help_buffer(void)
}
if (fnamecmp(e1, ".txt") != 0
&& fnamecmp(e1, fname + 4) != 0) {
- /* Not .txt and not .abx, remove it. */
- xfree(fnames[i1]);
- fnames[i1] = NULL;
+ // Not .txt and not .abx, remove it.
+ XFREE_CLEAR(fnames[i1]);
continue;
}
if (e1 - f1 != e2 - f2
@@ -5088,9 +5086,8 @@ void fix_help_buffer(void)
}
if (fnamecmp(e1, ".txt") == 0
&& fnamecmp(e2, fname + 4) == 0) {
- /* use .abx instead of .txt */
- xfree(fnames[i1]);
- fnames[i1] = NULL;
+ // use .abx instead of .txt
+ XFREE_CLEAR(fnames[i1]);
}
}
}