Mercurial > vim
diff src/ex_getln.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 | 59a16624400a |
children | 69e86e6e5703 |
line wrap: on
line diff
--- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -164,8 +164,7 @@ trigger_cmd_autocmd(int typechar, int ev static void abandon_cmdline(void) { - vim_free(ccline.cmdbuff); - ccline.cmdbuff = NULL; + VIM_CLEAR(ccline.cmdbuff); if (msg_scrolled == 0) compute_cmdrow(); MSG(""); @@ -500,10 +499,7 @@ getcmdline( && c != K_KPAGEDOWN && c != K_KPAGEUP && c != K_LEFT && c != K_RIGHT && (xpc.xp_numfiles > 0 || (c != Ctrl_P && c != Ctrl_N))) - { - vim_free(lookfor); - lookfor = NULL; - } + VIM_CLEAR(lookfor); #endif /* @@ -1096,8 +1092,7 @@ getcmdline( ) goto cmdline_not_changed; - vim_free(ccline.cmdbuff); /* no commandline to return */ - ccline.cmdbuff = NULL; + VIM_CLEAR(ccline.cmdbuff); /* no commandline to return */ if (!cmd_silent) { #ifdef FEAT_RIGHTLEFT @@ -3683,10 +3678,7 @@ nextwild( || ccline.cmdbuff[i + j] == '?') break; if ((int)STRLEN(p2) < j) - { - vim_free(p2); - p2 = NULL; - } + VIM_CLEAR(p2); } } } @@ -3832,8 +3824,7 @@ ExpandOne( { FreeWild(xp->xp_numfiles, xp->xp_files); xp->xp_numfiles = -1; - vim_free(orig_save); - orig_save = NULL; + VIM_CLEAR(orig_save); } findex = 0; @@ -6737,8 +6728,7 @@ finish_viminfo_history(vir_T *virp) else concat_history(type); - vim_free(viminfo_history[type]); - viminfo_history[type] = NULL; + VIM_CLEAR(viminfo_history[type]); viminfo_hisidx[type] = 0; } } @@ -6862,8 +6852,7 @@ write_viminfo_history(FILE *fp, int merg for (i = 0; i < viminfo_hisidx[type]; ++i) if (viminfo_history[type] != NULL) vim_free(viminfo_history[type][i].hisstr); - vim_free(viminfo_history[type]); - viminfo_history[type] = NULL; + VIM_CLEAR(viminfo_history[type]); viminfo_hisidx[type] = 0; } }