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/channel.c b/src/channel.c
index 138b12e..77df42d 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -317,8 +317,8 @@
/* If there is no callback then nobody can get readahead. If the fd is
* closed and there is no readahead then the callback won't be called. */
has_sock_msg = channel->ch_part[PART_SOCK].ch_fd != INVALID_FD
- || channel->ch_part[PART_SOCK].ch_head.rq_next != NULL
- || channel->ch_part[PART_SOCK].ch_json_head.jq_next != NULL;
+ || channel->ch_part[PART_SOCK].ch_head.rq_next != NULL
+ || channel->ch_part[PART_SOCK].ch_json_head.jq_next != NULL;
has_out_msg = channel->ch_part[PART_OUT].ch_fd != INVALID_FD
|| channel->ch_part[PART_OUT].ch_head.rq_next != NULL
|| channel->ch_part[PART_OUT].ch_json_head.jq_next != NULL;
@@ -2978,8 +2978,7 @@
channel_clear(channel_T *channel)
{
ch_log(channel, "Clearing channel");
- vim_free(channel->ch_hostname);
- channel->ch_hostname = NULL;
+ VIM_CLEAR(channel->ch_hostname);
channel_clear_one(channel, PART_SOCK);
channel_clear_one(channel, PART_OUT);
channel_clear_one(channel, PART_ERR);