1
0
forked from aniani/vim

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)
This commit is contained in:
Bram Moolenaar
2018-02-10 18:45:26 +01:00
parent 42443c7d7f
commit d23a823669
54 changed files with 233 additions and 465 deletions

View File

@@ -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)
{