diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-04-25 08:26:49 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-25 08:26:49 +0800 |
commit | c32fcd1ed527236e52cfd78033685e713ec36d75 (patch) | |
tree | 1749830896b6c1cd31dbe8ea762a5d650f287247 /src/nvim/runtime.c | |
parent | 7f084770c23855083776b0598f2f54bb59a06875 (diff) | |
download | rneovim-c32fcd1ed527236e52cfd78033685e713ec36d75.tar.gz rneovim-c32fcd1ed527236e52cfd78033685e713ec36d75.tar.bz2 rneovim-c32fcd1ed527236e52cfd78033685e713ec36d75.zip |
refactor(source): remove unnecessary concatenation with Lua (#28499)
Diffstat (limited to 'src/nvim/runtime.c')
-rw-r--r-- | src/nvim/runtime.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/nvim/runtime.c b/src/nvim/runtime.c index 9b8bfd4495..d913d311db 100644 --- a/src/nvim/runtime.c +++ b/src/nvim/runtime.c @@ -1889,11 +1889,6 @@ static bool concat_continued_line(garray_T *const ga, const int init_growsize, c } typedef struct { - linenr_T curr_lnum; - const linenr_T final_lnum; -} GetBufferLineCookie; - -typedef struct { char *buf; size_t offset; } GetStrLineCookie; @@ -2009,15 +2004,15 @@ void cmd_source_buffer(const exarg_T *const eap, bool ex_lua) ga_append(&ga, NL); } ((char *)ga.ga_data)[ga.ga_len - 1] = NUL; - const GetStrLineCookie cookie = { - .buf = ga.ga_data, - .offset = 0, - }; if (ex_lua || strequal(curbuf->b_p_ft, "lua") || (curbuf->b_fname && path_with_extension(curbuf->b_fname, "lua"))) { char *name = ex_lua ? ":{range}lua" : ":source (no file)"; - nlua_source_using_linegetter(get_str_line, (void *)&cookie, name); + nlua_source_str(ga.ga_data, name); } else { + const GetStrLineCookie cookie = { + .buf = ga.ga_data, + .offset = 0, + }; source_using_linegetter((void *)&cookie, get_str_line, ":source (no file)"); } ga_clear(&ga); |