summaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorChristian Brabandt <cb@256bit.org>2024-02-15 20:17:37 +0100
committerChristian Brabandt <cb@256bit.org>2024-02-15 20:17:37 +0100
commit9071ed8107244e0c56a16b77d1c28e975cb21dd2 (patch)
tree81dbf77196eba6af7b99de1785d7e2b5b4dfda68 /src/buffer.c
parentf0d3d4a42657dca996e790aa829de3c6be7fdb63 (diff)
patch 9.1.0113: duplicate code when cleaning undo stackv9.1.0113
Problem: duplicate code when cleaning undo stack Solution: refactor undo cleanup into a single public function related: #13928 Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c7
1 files changed, 3 insertions, 4 deletions
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