From f31db30975479cb6b57247f124a65f4362f80bfe Mon Sep 17 00:00:00 2001 From: bfredl Date: Thu, 30 Jun 2022 13:26:31 +0600 Subject: feat(lua): vim.ui_attach to get ui events from lua Co-authored-by: Famiu Haque --- src/nvim/memory.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/nvim/memory.c') diff --git a/src/nvim/memory.c b/src/nvim/memory.c index a9785fcb7c..acd2478c81 100644 --- a/src/nvim/memory.c +++ b/src/nvim/memory.c @@ -23,6 +23,7 @@ #include "nvim/message.h" #include "nvim/sign.h" #include "nvim/ui.h" +#include "nvim/ui_compositor.h" #include "nvim/vim.h" #ifdef UNIT_TESTING @@ -824,6 +825,7 @@ void free_all_mem(void) nlua_free_all_mem(); ui_free_all_mem(); + ui_comp_free_all_mem(); // should be last, in case earlier free functions deallocates arenas arena_free_reuse_blks(); -- cgit From 1ffd527c837fb2465c9659273bbe5447a1352db2 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Fri, 2 Sep 2022 17:39:49 +0100 Subject: refactor: migrate comment style (#20012) Done automatically using the following perl command: perl -pi -0777pe 's#\n\K */\*\n(.+?)\s*\*/\n#join("\n", map { $_ =~ s:^\s*\K \*://:; $_ } split("\n", $1)) . "\n"#sge' src/nvim/**/*.c Co-authored-by: zeertzjq Co-authored-by: zeertzjq --- src/nvim/memory.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'src/nvim/memory.c') diff --git a/src/nvim/memory.c b/src/nvim/memory.c index acd2478c81..e5fea027cb 100644 --- a/src/nvim/memory.c +++ b/src/nvim/memory.c @@ -502,10 +502,8 @@ bool striequal(const char *a, const char *b) return (a == NULL && b == NULL) || (a && b && STRICMP(a, b) == 0); } -/* - * Avoid repeating the error message many times (they take 1 second each). - * Did_outofmem_msg is reset when a character is read. - */ +// Avoid repeating the error message many times (they take 1 second each). +// Did_outofmem_msg is reset when a character is read. void do_outofmem_msg(size_t size) { if (!did_outofmem_msg) { @@ -675,13 +673,11 @@ char *arena_memdupz(Arena *arena, const char *buf, size_t size) # include "nvim/tag.h" # include "nvim/window.h" -/* - * Free everything that we allocated. - * Can be used to detect memory leaks, e.g., with ccmalloc. - * NOTE: This is tricky! Things are freed that functions depend on. Don't be - * surprised if Vim crashes... - * Some things can't be freed, esp. things local to a library function. - */ +// Free everything that we allocated. +// Can be used to detect memory leaks, e.g., with ccmalloc. +// NOTE: This is tricky! Things are freed that functions depend on. Don't be +// surprised if Vim crashes... +// Some things can't be freed, esp. things local to a library function. void free_all_mem(void) { buf_T *buf, *nextbuf; -- cgit From fc7a64291a5ed074eafff47b21b411bfe9d4a19e Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 5 Sep 2022 21:54:23 +0800 Subject: vim-patch:9.0.0386: some code blocks are nested too deep Problem: Some code blocks are nested too deep. Solution: Bail out earlier. (Yegappan Lakshmanan, closes vim/vim#11058) https://github.com/vim/vim/commit/b1f471ee20b0fa783ecd6e29aa69067e6c821376 --- src/nvim/memory.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/nvim/memory.c') diff --git a/src/nvim/memory.c b/src/nvim/memory.c index e5fea027cb..03cfde6160 100644 --- a/src/nvim/memory.c +++ b/src/nvim/memory.c @@ -506,16 +506,18 @@ bool striequal(const char *a, const char *b) // Did_outofmem_msg is reset when a character is read. void do_outofmem_msg(size_t size) { - if (!did_outofmem_msg) { - // Don't hide this message - emsg_silent = 0; + if (did_outofmem_msg) { + return; + } - /* Must come first to avoid coming back here when printing the error - * message fails, e.g. when setting v:errmsg. */ - did_outofmem_msg = true; + // Don't hide this message + emsg_silent = 0; - semsg(_("E342: Out of memory! (allocating %" PRIu64 " bytes)"), (uint64_t)size); - } + // Must come first to avoid coming back here when printing the error + // message fails, e.g. when setting v:errmsg. + did_outofmem_msg = true; + + semsg(_("E342: Out of memory! (allocating %" PRIu64 " bytes)"), (uint64_t)size); } /// Writes time_t to "buf[8]". -- cgit From 754822a066e6ce92462aa17fce8999472c23b777 Mon Sep 17 00:00:00 2001 From: notomo Date: Fri, 16 Sep 2022 18:06:37 +0900 Subject: fix(lua): free vim.ui_attach callback before lua close (#20205) --- src/nvim/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/memory.c') diff --git a/src/nvim/memory.c b/src/nvim/memory.c index 03cfde6160..61c43d8f99 100644 --- a/src/nvim/memory.c +++ b/src/nvim/memory.c @@ -821,9 +821,9 @@ void free_all_mem(void) decor_free_all_mem(); - nlua_free_all_mem(); ui_free_all_mem(); ui_comp_free_all_mem(); + nlua_free_all_mem(); // should be last, in case earlier free functions deallocates arenas arena_free_reuse_blks(); -- cgit