diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-02-10 18:45:26 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-02-10 18:45:26 +0100 |
commit | d23a823669d93fb2a570a039173eefe4856ac806 (patch) | |
tree | 617130258eae70e3bd7ef7b6da9c494ffee7b572 /src/ex_docmd.c | |
parent | 42443c7d7fecc3a2a72154bb6139b028438617c2 (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_docmd.c')
-rw-r--r-- | src/ex_docmd.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 591775f4c4..4082636767 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -868,8 +868,7 @@ do_cmdline( { /* Each '|' separated command is stored separately in lines_ga, to * be able to jump to it. Don't use next_cmdline now. */ - vim_free(cmdline_copy); - cmdline_copy = NULL; + VIM_CLEAR(cmdline_copy); /* Check if a function has returned or, unless it has an unclosed * try conditional, aborted. */ @@ -1084,8 +1083,7 @@ do_cmdline( if (next_cmdline == NULL) { - vim_free(cmdline_copy); - cmdline_copy = NULL; + VIM_CLEAR(cmdline_copy); #ifdef FEAT_CMDHIST /* * If the command was typed, remember it for the ':' register. @@ -5802,11 +5800,9 @@ uc_add_command( goto fail; } - vim_free(cmd->uc_rep); - cmd->uc_rep = NULL; + VIM_CLEAR(cmd->uc_rep); #if defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL) - vim_free(cmd->uc_compl_arg); - cmd->uc_compl_arg = NULL; + VIM_CLEAR(cmd->uc_compl_arg); #endif break; } @@ -8952,11 +8948,8 @@ static char_u *prev_dir = NULL; void free_cd_dir(void) { - vim_free(prev_dir); - prev_dir = NULL; - - vim_free(globaldir); - globaldir = NULL; + VIM_CLEAR(prev_dir); + VIM_CLEAR(globaldir); } #endif @@ -8967,8 +8960,7 @@ free_cd_dir(void) void post_chdir(int local) { - vim_free(curwin->w_localdir); - curwin->w_localdir = NULL; + VIM_CLEAR(curwin->w_localdir); if (local) { /* If still in global directory, need to remember current @@ -8983,8 +8975,7 @@ post_chdir(int local) { /* We are now in the global directory, no need to remember its * name. */ - vim_free(globaldir); - globaldir = NULL; + VIM_CLEAR(globaldir); } shorten_fnames(TRUE); |