summaryrefslogtreecommitdiff
path: root/src/if_cscope.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/if_cscope.c
parent42443c7d7fecc3a2a72154bb6139b028438617c2 (diff)
downloadvim-d23a823669d93fb2a570a039173eefe4856ac806.zip
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)
Diffstat (limited to 'src/if_cscope.c')
-rw-r--r--src/if_cscope.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/if_cscope.c b/src/if_cscope.c
index 4bf28ad1d..e4bcb51e0 100644
--- a/src/if_cscope.c
+++ b/src/if_cscope.c
@@ -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);
}