summaryrefslogtreecommitdiff
path: root/src/misc1.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/misc1.c
parent42443c7d7fecc3a2a72154bb6139b028438617c2 (diff)
downloadvim-git-d23a823669d93fb2a570a039173eefe4856ac806.tar.gz
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/misc1.c')
-rw-r--r--src/misc1.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/misc1.c b/src/misc1.c
index 593dce1c3..821869aa3 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -3745,8 +3745,7 @@ init_homedir(void)
char_u *var;
/* In case we are called a second time (when 'encoding' changes). */
- vim_free(homedir);
- homedir = NULL;
+ VIM_CLEAR(homedir);
#ifdef VMS
var = mch_getenv((char_u *)"SYS$LOGIN");
@@ -4358,10 +4357,7 @@ vim_getenv(char_u *name, int *mustfree)
p = vim_strnsave(p, (int)(pend - p));
if (p != NULL && !mch_isdir(p))
- {
- vim_free(p);
- p = NULL;
- }
+ VIM_CLEAR(p);
else
{
#ifdef USE_EXE_NAME
@@ -9775,8 +9771,7 @@ expand_wildcards(
/* If the number of matches is now zero, we fail. */
if (*num_files == 0)
{
- vim_free(*files);
- *files = NULL;
+ VIM_CLEAR(*files);
return FAIL;
}
}
@@ -10031,10 +10026,7 @@ dos_expandpath(
hFind = FindFirstFileW(wn, &wfb);
if (hFind == INVALID_HANDLE_VALUE
&& GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
- {
- vim_free(wn);
- wn = NULL;
- }
+ VIM_CLEAR(wn);
}
}
@@ -10122,8 +10114,7 @@ dos_expandpath(
# endif
hFind = FindFirstFile((LPCSTR)buf, &fb);
ok = (hFind != INVALID_HANDLE_VALUE);
- vim_free(matchname);
- matchname = NULL;
+ VIM_CLEAR(matchname);
}
}
@@ -11256,8 +11247,7 @@ get_cmd_output(
if (i != len)
{
EMSG2(_(e_notread), tempname);
- vim_free(buffer);
- buffer = NULL;
+ VIM_CLEAR(buffer);
}
else if (ret_len == NULL)
{