Mercurial > vim
diff src/misc1.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 | a49a5419a83f |
children | abaebba89fd4 |
line wrap: on
line diff
--- 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) {