Mercurial > vim
diff src/if_cscope.c @ 13244:ac42c4b11dbc v8.0.1496
patch 8.0.1496: clearing a pointer takes two lines
commit https://github.com/vim/vim/commit/d23a823669d93fb2a570a039173eefe4856ac806
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Feb 10 18:45:26 2018 +0100
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)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 10 Feb 2018 19:00:07 +0100 |
parents | bc735a129ea9 |
children | 69517d67421f |
line wrap: on
line diff
--- 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); }