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)
diff --git a/src/netbeans.c b/src/netbeans.c
index 199cfd6..bc3b8e6 100644
--- a/src/netbeans.c
+++ b/src/netbeans.c
@@ -580,8 +580,7 @@
buf.bufp->b_was_netbeans_file = FALSE;
}
}
- vim_free(buf_list);
- buf_list = NULL;
+ VIM_CLEAR(buf_list);
buf_list_size = 0;
buf_list_used = 0;
@@ -1477,8 +1476,7 @@
EMSG("E636: invalid buffer identifier in create");
return FAIL;
}
- vim_free(buf->displayname);
- buf->displayname = NULL;
+ VIM_CLEAR(buf->displayname);
netbeansReadFile = 0; /* don't try to open disk file */
do_ecmd(0, NULL, 0, 0, ECMD_ONE, ECMD_HIDE + ECMD_OLDBUF, curwin);
@@ -3447,8 +3445,7 @@
msg_add_lines(c, (long)lnum, nchars);
/* Now display it */
- vim_free(keep_msg);
- keep_msg = NULL;
+ VIM_CLEAR(keep_msg);
msg_scrolled_ign = TRUE;
msg_trunc_attr(IObuff, FALSE, 0);
msg_scrolled_ign = FALSE;
@@ -3475,8 +3472,7 @@
msg_add_lines(c, buf->bufp->b_ml.ml_line_count,
buf->bufp->b_orig_size);
- vim_free(keep_msg);
- keep_msg = NULL;
+ VIM_CLEAR(keep_msg);
msg_scrolled_ign = TRUE;
p = msg_trunc_attr(IObuff, FALSE, 0);
if ((msg_scrolled && !need_wait_return) || !buf->initDone)