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.
1a47ae32cd

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).
This commit is contained in:
zeertzjq
2022-08-13 13:48:11 +08:00
parent c1cbe3fb3d
commit f52c236c5b
23 changed files with 372 additions and 252 deletions

View File

@@ -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.