summaryrefslogtreecommitdiffstats
path: root/src/ex_cmds.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-02-10 18:45:26 +0100
committerBram Moolenaar <Bram@vim.org>2018-02-10 18:45:26 +0100
commitd23a823669d93fb2a570a039173eefe4856ac806 (patch)
tree617130258eae70e3bd7ef7b6da9c494ffee7b572 /src/ex_cmds.c
parent42443c7d7fecc3a2a72154bb6139b028438617c2 (diff)
patch 8.0.1496: clearing a pointer takes two linesv8.0.1496
Problem: Clearing a pointer takes two lines. Solution: Add VIM_CLEAR() and replace vim_clear(). (Hirohito Higashi, closes #2629)
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r--src/ex_cmds.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index f4129019ab..11dac06202 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -1957,8 +1957,7 @@ write_viminfo(char_u *file, int forceit)
if (!shortname && st_new.st_dev == st_old.st_dev
&& st_new.st_ino == st_old.st_ino)
{
- vim_free(tempname);
- tempname = NULL;
+ VIM_CLEAR(tempname);
shortname = TRUE;
break;
}
@@ -5225,8 +5224,7 @@ do_sub(exarg_T *eap)
lnum += regmatch.startpos[0].lnum;
sub_firstlnum += regmatch.startpos[0].lnum;
nmatch -= regmatch.startpos[0].lnum;
- vim_free(sub_firstline);
- sub_firstline = NULL;
+ VIM_CLEAR(sub_firstline);
}
if (sub_firstline == NULL)
@@ -5388,10 +5386,7 @@ do_sub(exarg_T *eap)
sub_firstline + copycol);
if (new_line == NULL)
- {
- vim_free(orig_line);
- orig_line = NULL;
- }
+ VIM_CLEAR(orig_line);
else
{
/* Position the cursor relative to the
@@ -5820,8 +5815,7 @@ skip:
if (did_sub)
++sub_nlines;
vim_free(new_start); /* for when substitute was cancelled */
- vim_free(sub_firstline); /* free the copy of the original line */
- sub_firstline = NULL;
+ VIM_CLEAR(sub_firstline); /* free the copy of the original line */
}
line_breakcheck();
@@ -6975,8 +6969,7 @@ fix_help_buffer(void)
&& fnamecmp(e1, fname + 4) != 0)
{
/* Not .txt and not .abx, remove it. */
- vim_free(fnames[i1]);
- fnames[i1] = NULL;
+ VIM_CLEAR(fnames[i1]);
continue;
}
if (e1 - f1 != e2 - f2
@@ -6984,11 +6977,8 @@ fix_help_buffer(void)
continue;
if (fnamecmp(e1, ".txt") == 0
&& fnamecmp(e2, fname + 4) == 0)
- {
/* use .abx instead of .txt */
- vim_free(fnames[i1]);
- fnames[i1] = NULL;
- }
+ VIM_CLEAR(fnames[i1]);
}
}
#endif