Mercurial > vim
diff src/ex_cmds.c @ 13244:ac42c4b11dbc v8.0.1496
patch 8.0.1496: clearing a pointer takes two lines
commit https://github.com/vim/vim/commit/d23a823669d93fb2a570a039173eefe4856ac806
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Feb 10 18:45:26 2018 +0100
patch 8.0.1496: clearing a pointer takes two lines
Problem: Clearing a pointer takes two lines.
Solution: Add VIM_CLEAR() and replace vim_clear(). (Hirohito Higashi,
closes #2629)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 10 Feb 2018 19:00:07 +0100 |
parents | 1bf3519889d3 |
children | 50e1077e0c3d |
line wrap: on
line diff
--- 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