0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

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

@@ -1479,8 +1479,7 @@ cs_insert_filelist(
{
if ((csinfo[i].ppath = (char *)alloc((unsigned)strlen(ppath) + 1)) == NULL)
{
vim_free(csinfo[i].fname);
csinfo[i].fname = NULL;
VIM_CLEAR(csinfo[i].fname);
return -1;
}
(void)strcpy(csinfo[i].ppath, (const char *)ppath);
@@ -1491,10 +1490,8 @@ cs_insert_filelist(
{
if ((csinfo[i].flags = (char *)alloc((unsigned)strlen(flags) + 1)) == NULL)
{
vim_free(csinfo[i].fname);
vim_free(csinfo[i].ppath);
csinfo[i].fname = NULL;
csinfo[i].ppath = NULL;
VIM_CLEAR(csinfo[i].fname);
VIM_CLEAR(csinfo[i].ppath);
return -1;
}
(void)strcpy(csinfo[i].flags, (const char *)flags);
@@ -1939,10 +1936,8 @@ parse_out:
if (totsofar == 0)
{
/* No matches, free the arrays and return NULL in "*matches_p". */
vim_free(matches);
matches = NULL;
vim_free(cntxts);
cntxts = NULL;
VIM_CLEAR(matches);
VIM_CLEAR(cntxts);
}
*matched = totsofar;
*matches_p = matches;
@@ -2445,7 +2440,7 @@ cs_resolve_file(int i, char *name)
if (csdir != NULL)
{
vim_strncpy(csdir, (char_u *)csinfo[i].fname,
gettail((char_u *)csinfo[i].fname)
gettail((char_u *)csinfo[i].fname)
- (char_u *)csinfo[i].fname);
len += (int)STRLEN(csdir);
}