aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testing.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-08-13 13:48:11 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-08-14 04:29:44 +0800
commitf52c236c5b432629f0e074c3511e7e9d481197b1 (patch)
tree7a489a7a2a50db96e4aef4eeb24fd1cec2e78d5b /src/nvim/testing.c
parentc1cbe3fb3d2ec1dbcfdc14ee2d9a5e8049d494ae (diff)
downloadrneovim-f52c236c5b432629f0e074c3511e7e9d481197b1.tar.gz
rneovim-f52c236c5b432629f0e074c3511e7e9d481197b1.tar.bz2
rneovim-f52c236c5b432629f0e074c3511e7e9d481197b1.zip
vim-patch:8.2.0056: execution stack is incomplete and inefficient
Problem: Execution stack is incomplete and inefficient. Solution: Introduce a proper execution stack and use it instead of sourcing_name/sourcing_lnum. Create a string only when used. https://github.com/vim/vim/commit/1a47ae32cdc19b0fd5a82e19fe5fddf45db1a506 Omit test_debugger.vim: superseded by later patches. Omit check_map_keycodes(): N/A. Omit kword_test.c: N/A (converted to a unit test).
Diffstat (limited to 'src/nvim/testing.c')
-rw-r--r--src/nvim/testing.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/nvim/testing.c b/src/nvim/testing.c
index 69b687e44f..de6d445ba3 100644
--- a/src/nvim/testing.c
+++ b/src/nvim/testing.c
@@ -7,6 +7,7 @@
#include "nvim/eval/encode.h"
#include "nvim/ex_docmd.h"
#include "nvim/os/os.h"
+#include "nvim/runtime.h"
#include "nvim/testing.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
@@ -17,21 +18,23 @@
static void prepare_assert_error(garray_T *gap)
{
char buf[NUMBUFLEN];
+ char *sname = estack_sfile();
ga_init(gap, 1, 100);
- if (sourcing_name != NULL) {
- ga_concat(gap, (char *)sourcing_name);
- if (sourcing_lnum > 0) {
+ if (sname != NULL) {
+ ga_concat(gap, sname);
+ if (SOURCING_LNUM > 0) {
ga_concat(gap, " ");
}
}
- if (sourcing_lnum > 0) {
- vim_snprintf(buf, ARRAY_SIZE(buf), "line %" PRId64, (int64_t)sourcing_lnum);
+ if (SOURCING_LNUM > 0) {
+ vim_snprintf(buf, ARRAY_SIZE(buf), "line %" PRId64, (int64_t)SOURCING_LNUM);
ga_concat(gap, buf);
}
- if (sourcing_name != NULL || sourcing_lnum > 0) {
+ if (sname != NULL || SOURCING_LNUM > 0) {
ga_concat(gap, ": ");
}
+ xfree(sname);
}
/// Append "p[clen]" to "gap", escaping unprintable characters.