diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-08-29 23:25:16 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-08-30 00:24:46 -0400 |
commit | 97c1775646b87e7127a93daa13aab3d09e8e4b88 (patch) | |
tree | e68f5095f44dcbee66263df40798524875d1d8fc | |
parent | f575b714499bf74ca99597fc5d115395e14dfcd1 (diff) | |
download | rneovim-97c1775646b87e7127a93daa13aab3d09e8e4b88.tar.gz rneovim-97c1775646b87e7127a93daa13aab3d09e8e4b88.tar.bz2 rneovim-97c1775646b87e7127a93daa13aab3d09e8e4b88.zip |
vim-patch:8.1.0233: "safe" argument of call_vim_function() is always FALSE
Problem: "safe" argument of call_vim_function() is always FALSE.
Solution: Remove the argument.
https://github.com/vim/vim/commit/ded27a1febda3db7447958b60a7d791af514d124
-rw-r--r-- | src/nvim/edit.c | 5 | ||||
-rw-r--r-- | src/nvim/eval.c | 37 | ||||
-rw-r--r-- | src/nvim/ex_getln.c | 12 | ||||
-rw-r--r-- | src/nvim/normal.c | 5 |
4 files changed, 20 insertions, 39 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 1d795621e5..ca64cc091d 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -3722,7 +3722,7 @@ expand_by_function( curbuf_save = curbuf; // Call a function, which returns a list or dict. - if (call_vim_function(funcname, 2, args, &rettv, false) == OK) { + if (call_vim_function(funcname, 2, args, &rettv) == OK) { switch (rettv.v_type) { case VAR_LIST: matchlist = rettv.vval.v_list; @@ -4913,7 +4913,6 @@ static int ins_complete(int c, bool enable_pum) * Call user defined function 'completefunc' with "a:findstart" * set to 1 to obtain the length of text to use for completion. */ - int col; char_u *funcname; pos_T pos; win_T *curwin_save; @@ -4942,7 +4941,7 @@ static int ins_complete(int c, bool enable_pum) pos = curwin->w_cursor; curwin_save = curwin; curbuf_save = curbuf; - col = call_func_retnr(funcname, 2, args, false); + int col = call_func_retnr(funcname, 2, args); State = save_State; if (curwin_save != curwin || curbuf_save != curbuf) { diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 9f1f564a9b..12c53fa804 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -1307,27 +1307,17 @@ int call_vim_function( const char_u *func, int argc, typval_T *argv, - typval_T *rettv, - bool safe // use the sandbox + typval_T *rettv ) + FUNC_ATTR_NONNULL_ALL { int doesrange; - void *save_funccalp = NULL; int ret; - if (safe) { - save_funccalp = save_funccal(); - ++sandbox; - } - rettv->v_type = VAR_UNKNOWN; // tv_clear() uses this. ret = call_func(func, (int)STRLEN(func), rettv, argc, argv, NULL, curwin->w_cursor.lnum, curwin->w_cursor.lnum, &doesrange, true, NULL, NULL); - if (safe) { - --sandbox; - restore_funccal(save_funccalp); - } if (ret == FAIL) { tv_clear(rettv); @@ -1340,16 +1330,16 @@ int call_vim_function( /// @param[in] func Function name. /// @param[in] argc Number of arguments. /// @param[in] argv Array with typval_T arguments. -/// @param[in] safe Use with sandbox. /// /// @return -1 when calling function fails, result of function otherwise. -varnumber_T call_func_retnr(char_u *func, int argc, - typval_T *argv, int safe) +varnumber_T call_func_retnr(const char_u *func, int argc, + typval_T *argv) + FUNC_ATTR_NONNULL_ALL { typval_T rettv; varnumber_T retval; - if (call_vim_function(func, argc, argv, &rettv, safe) == FAIL) { + if (call_vim_function(func, argc, argv, &rettv) == FAIL) { return -1; } retval = tv_get_number_chk(&rettv, NULL); @@ -1361,18 +1351,16 @@ varnumber_T call_func_retnr(char_u *func, int argc, /// @param[in] func Function name. /// @param[in] argc Number of arguments. /// @param[in] argv Array with typval_T arguments. -/// @param[in] safe Use the sandbox. /// /// @return [allocated] NULL when calling function fails, allocated string /// otherwise. char *call_func_retstr(const char *const func, int argc, - typval_T *argv, - bool safe) - FUNC_ATTR_NONNULL_ARG(1) FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_MALLOC + typval_T *argv) + FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_MALLOC { typval_T rettv; // All arguments are passed as strings, no conversion to number. - if (call_vim_function((const char_u *)func, argc, argv, &rettv, safe) + if (call_vim_function((const char_u *)func, argc, argv, &rettv) == FAIL) { return NULL; } @@ -1386,17 +1374,16 @@ char *call_func_retstr(const char *const func, int argc, /// @param[in] func Function name. /// @param[in] argc Number of arguments. /// @param[in] argv Array with typval_T arguments. -/// @param[in] safe Use the sandbox. /// /// @return [allocated] NULL when calling function fails or return tv is not a /// List, allocated List otherwise. -void *call_func_retlist(char_u *func, int argc, typval_T *argv, - bool safe) +void *call_func_retlist(const char_u *func, int argc, typval_T *argv) + FUNC_ATTR_NONNULL_ALL { typval_T rettv; // All arguments are passed as strings, no conversion to number. - if (call_vim_function(func, argc, argv, &rettv, safe) == FAIL) { + if (call_vim_function(func, argc, argv, &rettv) == FAIL) { return NULL; } diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 2b01e2d72b..4e43e95c2e 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -198,10 +198,7 @@ static Array cmdline_block = ARRAY_DICT_INIT; /* * Type used by call_user_expand_func */ -typedef void *(*user_expand_func_T)(const char_u *, - int, - typval_T *, - bool); +typedef void *(*user_expand_func_T)(const char_u *, int, typval_T *); static histentry_T *(history[HIST_COUNT]) = {NULL, NULL, NULL, NULL, NULL}; static int hisidx[HIST_COUNT] = {-1, -1, -1, -1, -1}; /* lastused entry */ @@ -5059,12 +5056,12 @@ static void expand_shellcmd(char_u *filepat, int *num_file, char_u ***file, /// return the result (either a string or a List). static void * call_user_expand_func(user_expand_func_T user_expand_func, expand_T *xp, int *num_file, char_u ***file) + FUNC_ATTR_NONNULL_ALL { char_u keep = 0; typval_T args[4]; char_u *pat = NULL; int save_current_SID = current_SID; - void *ret; struct cmdline_info save_ccline; if (xp->xp_arg == NULL || xp->xp_arg[0] == '\0' || xp->xp_line == NULL) @@ -5092,10 +5089,7 @@ static void * call_user_expand_func(user_expand_func_T user_expand_func, ccline.cmdprompt = NULL; current_SID = xp->xp_scriptID; - ret = user_expand_func(xp->xp_arg, - 3, - args, - false); + void *const ret = user_expand_func(xp->xp_arg, 3, args); ccline = save_ccline; current_SID = save_current_SID; diff --git a/src/nvim/normal.c b/src/nvim/normal.c index bfd91e688e..819ca83d27 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -2082,7 +2082,8 @@ static void op_colon(oparg_T *oap) /* * Handle the "g@" operator: call 'operatorfunc'. */ -static void op_function(oparg_T *oap) +static void op_function(const oparg_T *oap) + FUNC_ATTR_NONNULL_ALL { const TriState save_virtual_op = virtual_op; @@ -2111,7 +2112,7 @@ static void op_function(oparg_T *oap) // function. virtual_op = kNone; - (void)call_func_retnr(p_opfunc, 1, argv, false); + (void)call_func_retnr(p_opfunc, 1, argv); virtual_op = save_virtual_op; } |