diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-05-22 01:02:26 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2019-05-25 10:07:05 +0200 |
commit | ae846b41dfed16446be6469cb01f12f1eb1fa534 (patch) | |
tree | 2851845f2faf61d5945cb4f1d8761316201a6246 /src/nvim/buffer.c | |
parent | a9d7ec4587d8eb20f12ebecc427ad818fb0e4971 (diff) | |
download | rneovim-ae846b41dfed16446be6469cb01f12f1eb1fa534.tar.gz rneovim-ae846b41dfed16446be6469cb01f12f1eb1fa534.tar.bz2 rneovim-ae846b41dfed16446be6469cb01f12f1eb1fa534.zip |
vim-patch:8.0.1496: VIM_CLEAR()
Problem: Clearing a pointer takes two lines.
Solution: Add VIM_CLEAR() and replace vim_clear(). (Hirohito Higashi,
closes #2629)
vim-patch:8.0.1481
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r-- | src/nvim/buffer.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 8a3d4ad418..a5ad1f1a11 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -809,8 +809,7 @@ free_buffer_stuff( bufhl_clear_all(buf); // delete any highligts map_clear_int(buf, MAP_ALL_MODES, true, false); // clear local mappings map_clear_int(buf, MAP_ALL_MODES, true, true); // clear local abbrevs - xfree(buf->b_start_fenc); - buf->b_start_fenc = NULL; + XFREE_CLEAR(buf->b_start_fenc); buf_updates_unregister_all(buf); } @@ -1756,10 +1755,8 @@ buf_T * buflist_new(char_u *ffname, char_u *sfname, linenr_T lnum, int flags) buf->b_wininfo = xcalloc(1, sizeof(wininfo_T)); if (ffname != NULL && (buf->b_ffname == NULL || buf->b_sfname == NULL)) { - xfree(buf->b_ffname); - buf->b_ffname = NULL; - xfree(buf->b_sfname); - buf->b_sfname = NULL; + XFREE_CLEAR(buf->b_ffname); + XFREE_CLEAR(buf->b_sfname); if (buf != curbuf) { free_buffer(buf); } @@ -2665,10 +2662,8 @@ setfname( if (ffname == NULL || *ffname == NUL) { // Removing the name. - xfree(buf->b_ffname); - xfree(buf->b_sfname); - buf->b_ffname = NULL; - buf->b_sfname = NULL; + XFREE_CLEAR(buf->b_ffname); + XFREE_CLEAR(buf->b_sfname); } else { fname_expand(buf, &ffname, &sfname); // will allocate ffname if (ffname == NULL) { // out of memory @@ -3791,8 +3786,7 @@ int build_stl_str_hl( if (str != NULL && *str != 0) { if (*skipdigits(str) == NUL) { num = atoi((char *)str); - xfree(str); - str = NULL; + XFREE_CLEAR(str); itemisflag = false; } } |