summaryrefslogtreecommitdiffstats
path: root/src/undo.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 07:39:41 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 07:39:41 +0000
commit00c068502d170f9f9b59c4a68aa12e8835859f6c (patch)
tree2047fc01b8c70326d9b87b47a575e7e5f2141b62 /src/undo.c
parentAdding upstream version 2:9.1.0016. (diff)
downloadvim-00c068502d170f9f9b59c4a68aa12e8835859f6c.tar.xz
vim-00c068502d170f9f9b59c4a68aa12e8835859f6c.zip
Adding upstream version 2:9.1.0199.upstream/2%9.1.0199
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--src/undo.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/src/undo.c b/src/undo.c
index b2c4e9a..1cd8912 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -123,6 +123,7 @@ static void serialize_visualinfo(bufinfo_T *bi, visualinfo_T *info);
static void unserialize_visualinfo(bufinfo_T *bi, visualinfo_T *info);
#endif
static void u_saveline(linenr_T lnum);
+static void u_blockfree(buf_T *buf);
#define U_ALLOC_LINE(size) lalloc(size, FALSE)
@@ -3472,7 +3473,7 @@ u_freeentry(u_entry_T *uep, long n)
/*
* invalidate the undo buffer; called when storage has already been released
*/
- void
+ static void
u_clearall(buf_T *buf)
{
buf->b_u_newhead = buf->b_u_oldhead = buf->b_u_curhead = NULL;
@@ -3484,6 +3485,30 @@ u_clearall(buf_T *buf)
}
/*
+ * Free all allocated memory blocks for the buffer 'buf'.
+ */
+ static void
+u_blockfree(buf_T *buf)
+{
+ while (buf->b_u_oldhead != NULL)
+ u_freeheader(buf, buf->b_u_oldhead, NULL);
+ vim_free(buf->b_u_line_ptr.ul_line);
+}
+
+/*
+ * Free all allocated memory blocks for the buffer 'buf'.
+ * and invalidate the undo buffer
+ */
+ void
+u_clearallandblockfree(buf_T *buf)
+{
+ u_blockfree(buf);
+ u_clearall(buf);
+}
+
+
+
+/*
* Save the line "lnum" for the "U" command.
*/
static void
@@ -3563,17 +3588,6 @@ u_undoline(void)
}
/*
- * Free all allocated memory blocks for the buffer 'buf'.
- */
- void
-u_blockfree(buf_T *buf)
-{
- while (buf->b_u_oldhead != NULL)
- u_freeheader(buf, buf->b_u_oldhead, NULL);
- vim_free(buf->b_u_line_ptr.ul_line);
-}
-
-/*
* Check if the 'modified' flag is set, or 'ff' has changed (only need to
* check the first character, because it can only be "dos", "unix" or "mac").
* "nofile" and "scratch" type buffers are considered to always be unchanged.