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)
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 591775f..4082636 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -868,8 +868,7 @@
{
/* 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 @@
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 @@
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 @@
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 @@
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 @@
{
/* We are now in the global directory, no need to remember its
* name. */
- vim_free(globaldir);
- globaldir = NULL;
+ VIM_CLEAR(globaldir);
}
shorten_fnames(TRUE);