diff src/terminal.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 4b8d89ea9edb
children fc33325c91c1
line wrap: on
line diff
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -1176,8 +1176,7 @@ move_terminal_to_buffer(term_T *term)
 set_terminal_mode(term_T *term, int normal_mode)
 {
     term->tl_normal_mode = normal_mode;
-    vim_free(term->tl_status_text);
-    term->tl_status_text = NULL;
+    VIM_CLEAR(term->tl_status_text);
     if (term->tl_buffer == curbuf)
 	maketitle();
 }
@@ -1739,10 +1738,8 @@ term_job_ended(job_T *job)
     for (term = first_term; term != NULL; term = term->tl_next)
 	if (term->tl_job == job)
 	{
-	    vim_free(term->tl_title);
-	    term->tl_title = NULL;
-	    vim_free(term->tl_status_text);
-	    term->tl_status_text = NULL;
+	    VIM_CLEAR(term->tl_title);
+	    VIM_CLEAR(term->tl_status_text);
 	    redraw_buf_and_status_later(term->tl_buffer, VALID);
 	    did_one = TRUE;
 	}
@@ -2023,8 +2020,7 @@ handle_settermprop(
 #endif
 	    else
 		term->tl_title = vim_strsave((char_u *)value->string);
-	    vim_free(term->tl_status_text);
-	    term->tl_status_text = NULL;
+	    VIM_CLEAR(term->tl_status_text);
 	    if (term == curbuf->b_term)
 		maketitle();
 	    break;
@@ -2189,10 +2185,8 @@ term_channel_closed(channel_T *ch)
 	    term->tl_channel_closed = TRUE;
 	    did_one = TRUE;
 
-	    vim_free(term->tl_title);
-	    term->tl_title = NULL;
-	    vim_free(term->tl_status_text);
-	    term->tl_status_text = NULL;
+	    VIM_CLEAR(term->tl_title);
+	    VIM_CLEAR(term->tl_status_text);
 
 	    /* Unless in Terminal-Normal mode: clear the vterm. */
 	    if (!term->tl_normal_mode)