diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-05-25 14:49:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-25 14:49:43 +0200 |
commit | 2f023f40b275a904c96d5b287e9e9abe6df1aec7 (patch) | |
tree | 36f2b5bec81f7144c5bd3787f33959bd60c59e0e /src/nvim/message.c | |
parent | 4769deb36a54c3b2a4a2d2addb2937c1aa7dd629 (diff) | |
parent | eddd1bff3e7bf8df7405f6b0bfd01a5bb8ba20a9 (diff) | |
download | rneovim-2f023f40b275a904c96d5b287e9e9abe6df1aec7.tar.gz rneovim-2f023f40b275a904c96d5b287e9e9abe6df1aec7.tar.bz2 rneovim-2f023f40b275a904c96d5b287e9e9abe6df1aec7.zip |
Merge #10046 from justinmk/xfree
refactor: introduce XFREE_CLEAR()
Diffstat (limited to 'src/nvim/message.c')
-rw-r--r-- | src/nvim/message.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/nvim/message.c b/src/nvim/message.c index cb83d6482c..077c28eb2c 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -420,8 +420,7 @@ static char_u *last_sourcing_name = NULL; */ void reset_last_sourcing(void) { - xfree(last_sourcing_name); - last_sourcing_name = NULL; + XFREE_CLEAR(last_sourcing_name); last_sourcing_lnum = 0; } @@ -1117,8 +1116,7 @@ void wait_return(int redraw) reset_last_sourcing(); if (keep_msg != NULL && vim_strsize(keep_msg) >= (Rows - cmdline_row - 1) * Columns + sc_col) { - xfree(keep_msg); - keep_msg = NULL; /* don't redisplay message, it's too long */ + XFREE_CLEAR(keep_msg); // don't redisplay message, it's too long } if (tmpState == SETWSIZE) { /* got resize event while in vgetc() */ @@ -1188,8 +1186,7 @@ void msg_start(void) int did_return = FALSE; if (!msg_silent) { - xfree(keep_msg); - keep_msg = NULL; /* don't display old message now */ + XFREE_CLEAR(keep_msg); // don't display old message now } if (need_clr_eos) { @@ -3000,9 +2997,8 @@ void give_warning(char_u *message, bool hl) FUNC_ATTR_NONNULL_ARG(1) /* Don't want a hit-enter prompt here. */ ++no_wait_return; - set_vim_var_string(VV_WARNINGMSG, (char *) message, -1); - xfree(keep_msg); - keep_msg = NULL; + set_vim_var_string(VV_WARNINGMSG, (char *)message, -1); + XFREE_CLEAR(keep_msg); if (hl) { keep_msg_attr = HL_ATTR(HLF_W); } else { |