From 860a7e4d210aabb38bf783dade5e742834732700 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 15 Sep 2025 23:39:43 -0400 Subject: [PATCH] vim-patch:8.1.2021: some global functions can be local to the file Problem: Some global functions can be local to the file. Solution: Add "static". (Yegappan Lakshmanan, closes vim/vim#4917) https://github.com/vim/vim/commit/840d16fd36bfd1a9fac8200e3dc016b1e3f9c328 Partial port because patch 8.2.0256 moves the timer functions to time.c. Co-authored-by: Bram Moolenaar --- src/nvim/eval.c | 13 ++++++++++++- src/nvim/eval/funcs.c | 11 ----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/nvim/eval.c b/src/nvim/eval.c index eb6d70352b..b47c77dec2 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -5865,7 +5865,7 @@ static list_T *string_to_list(const char *str, size_t len, const bool keepempty) } /// os_system wrapper. Handles 'verbose', :profile, and v:shell_error. -void get_system_output_as_rettv(typval_T *argvars, typval_T *rettv, bool retlist) +static void get_system_output_as_rettv(typval_T *argvars, typval_T *rettv, bool retlist) { proftime_T wait_time; bool profiling = do_profiling == PROF_YES; @@ -5963,6 +5963,17 @@ void get_system_output_as_rettv(typval_T *argvars, typval_T *rettv, bool retlist } } +/// f_system - the Vimscript system() function +void f_system(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) +{ + get_system_output_as_rettv(argvars, rettv, false); +} + +void f_systemlist(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) +{ + get_system_output_as_rettv(argvars, rettv, true); +} + /// Get a callback from "arg". It can be a Funcref or a function name. bool callback_from_typval(Callback *const callback, const typval_T *const arg) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 0f8d8b8d76..8e68ac9b9a 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -7950,17 +7950,6 @@ static void f_synstack(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) } } -/// f_system - the Vimscript system() function -static void f_system(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) -{ - get_system_output_as_rettv(argvars, rettv, false); -} - -static void f_systemlist(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) -{ - get_system_output_as_rettv(argvars, rettv, true); -} - /// "tabpagebuflist()" function static void f_tabpagebuflist(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) {