From 9071ed8107244e0c56a16b77d1c28e975cb21dd2 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Thu, 15 Feb 2024 20:17:37 +0100 Subject: patch 9.1.0113: duplicate code when cleaning undo stack Problem: duplicate code when cleaning undo stack Solution: refactor undo cleanup into a single public function related: #13928 Signed-off-by: Christian Brabandt --- src/buffer.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index 62c396a531..4a39329c5c 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -919,10 +919,9 @@ buf_freeall(buf_T *buf, int flags) ml_close(buf, TRUE); // close and delete the memline/memfile buf->b_ml.ml_line_count = 0; // no lines in buffer if ((flags & BFA_KEEP_UNDO) == 0) - { - u_blockfree(buf); // free the memory allocated for undo - u_clearall(buf); // reset all undo information - } + // free the memory allocated for undo + // and reset all undo information + u_clearallandblockfree(buf); #ifdef FEAT_SYN_HL syntax_clear(&buf->b_s); // reset syntax info #endif -- cgit v1.2.3