From c05e7f0fdd15d550cfb1054416a08d4514a4fb7e Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Mon, 9 Jan 2017 14:35:04 +0100 Subject: vim-patch:7.4.2024 Problem: More buf_valid() calls can be optimized. Solution: Use bufref_valid() instead. NOTE: Some changes related to channels and the Python and Netbeans interfaces were obviously left out. https://github.com/vim/vim/commit/7c0a2f367f2507669560b1a66423155c70d2e75b --- src/nvim/memory.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/nvim/memory.c') diff --git a/src/nvim/memory.c b/src/nvim/memory.c index 25fa2f150e..51e0dd926e 100644 --- a/src/nvim/memory.c +++ b/src/nvim/memory.c @@ -629,12 +629,12 @@ void free_all_mem(void) * were freed already. */ p_acd = false; for (buf = firstbuf; buf != NULL; ) { + bufref_T bufref; + set_bufref(&bufref, buf); nextbuf = buf->b_next; close_buffer(NULL, buf, DOBUF_WIPE, false); - if (buf_valid(buf)) - buf = nextbuf; /* didn't work, try next one */ - else - buf = firstbuf; + // Didn't work, try next one. + buf = bufref_valid(&bufref) ? nextbuf : firstbuf; } free_cmdline_buf(); -- cgit