Skip to content

Commit ded27a1

Browse files
committed
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.
1 parent f711cb2 commit ded27a1

File tree

7 files changed

+20
-35
lines changed

7 files changed

+20
-35
lines changed

src/edit.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4239,7 +4239,7 @@ expand_by_function(
42394239
curbuf_save = curbuf;
42404240

42414241
/* Call a function, which returns a list or dict. */
4242-
if (call_vim_function(funcname, 2, args, &rettv, FALSE) == OK)
4242+
if (call_vim_function(funcname, 2, args, &rettv) == OK)
42434243
{
42444244
switch (rettv.v_type)
42454245
{
@@ -5569,7 +5569,7 @@ ins_complete(int c, int enable_pum)
55695569
pos = curwin->w_cursor;
55705570
curwin_save = curwin;
55715571
curbuf_save = curbuf;
5572-
col = call_func_retnr(funcname, 2, args, FALSE);
5572+
col = call_func_retnr(funcname, 2, args);
55735573
if (curwin_save != curwin || curbuf_save != curbuf)
55745574
{
55755575
EMSG(_(e_complwin));

src/eval.c

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,29 +1021,15 @@ call_vim_function(
10211021
char_u *func,
10221022
int argc,
10231023
typval_T *argv,
1024-
typval_T *rettv,
1025-
int safe) /* use the sandbox */
1024+
typval_T *rettv)
10261025
{
10271026
int doesrange;
1028-
void *save_funccalp = NULL;
10291027
int ret;
10301028

1031-
if (safe)
1032-
{
1033-
save_funccalp = save_funccal();
1034-
++sandbox;
1035-
}
1036-
10371029
rettv->v_type = VAR_UNKNOWN; /* clear_tv() uses this */
10381030
ret = call_func(func, (int)STRLEN(func), rettv, argc, argv, NULL,
10391031
curwin->w_cursor.lnum, curwin->w_cursor.lnum,
10401032
&doesrange, TRUE, NULL, NULL);
1041-
if (safe)
1042-
{
1043-
--sandbox;
1044-
restore_funccal(save_funccalp);
1045-
}
1046-
10471033
if (ret == FAIL)
10481034
clear_tv(rettv);
10491035

@@ -1060,13 +1046,12 @@ call_vim_function(
10601046
call_func_retnr(
10611047
char_u *func,
10621048
int argc,
1063-
typval_T *argv,
1064-
int safe) /* use the sandbox */
1049+
typval_T *argv)
10651050
{
10661051
typval_T rettv;
10671052
varnumber_T retval;
10681053

1069-
if (call_vim_function(func, argc, argv, &rettv, safe) == FAIL)
1054+
if (call_vim_function(func, argc, argv, &rettv) == FAIL)
10701055
return -1;
10711056

10721057
retval = get_tv_number_chk(&rettv, NULL);
@@ -1088,13 +1073,12 @@ call_func_retnr(
10881073
call_func_retstr(
10891074
char_u *func,
10901075
int argc,
1091-
typval_T *argv,
1092-
int safe) /* use the sandbox */
1076+
typval_T *argv)
10931077
{
10941078
typval_T rettv;
10951079
char_u *retval;
10961080

1097-
if (call_vim_function(func, argc, argv, &rettv, safe) == FAIL)
1081+
if (call_vim_function(func, argc, argv, &rettv) == FAIL)
10981082
return NULL;
10991083

11001084
retval = vim_strsave(get_tv_string(&rettv));
@@ -1113,12 +1097,11 @@ call_func_retstr(
11131097
call_func_retlist(
11141098
char_u *func,
11151099
int argc,
1116-
typval_T *argv,
1117-
int safe) /* use the sandbox */
1100+
typval_T *argv)
11181101
{
11191102
typval_T rettv;
11201103

1121-
if (call_vim_function(func, argc, argv, &rettv, safe) == FAIL)
1104+
if (call_vim_function(func, argc, argv, &rettv) == FAIL)
11221105
return NULL;
11231106

11241107
if (rettv.v_type != VAR_LIST)

src/ex_getln.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5279,7 +5279,7 @@ expand_shellcmd(
52795279
*/
52805280
static void *
52815281
call_user_expand_func(
5282-
void *(*user_expand_func)(char_u *, int, typval_T *, int),
5282+
void *(*user_expand_func)(char_u *, int, typval_T *),
52835283
expand_T *xp,
52845284
int *num_file,
52855285
char_u ***file)
@@ -5318,7 +5318,7 @@ call_user_expand_func(
53185318
ccline.cmdprompt = NULL;
53195319
current_SID = xp->xp_scriptID;
53205320

5321-
ret = user_expand_func(xp->xp_arg, 3, args, FALSE);
5321+
ret = user_expand_func(xp->xp_arg, 3, args);
53225322

53235323
ccline = save_ccline;
53245324
current_SID = save_current_SID;

src/mbyte.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4825,7 +4825,7 @@ call_imactivatefunc(int active)
48254825
argv[0].v_type = VAR_NUMBER;
48264826
argv[0].vval.v_number = active ? 1 : 0;
48274827
argv[1].v_type = VAR_UNKNOWN;
4828-
(void)call_func_retnr(p_imaf, 1, argv, FALSE);
4828+
(void)call_func_retnr(p_imaf, 1, argv);
48294829
}
48304830

48314831
static int
@@ -4839,7 +4839,7 @@ call_imstatusfunc(void)
48394839
/* FIXME: :py print 'xxx' is shown duplicate result.
48404840
* Use silent to avoid it. */
48414841
++msg_silent;
4842-
is_active = call_func_retnr(p_imsf, 0, NULL, FALSE);
4842+
is_active = call_func_retnr(p_imsf, 0, NULL);
48434843
--msg_silent;
48444844
return (is_active > 0);
48454845
}

src/normal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2248,7 +2248,7 @@ op_function(oparg_T *oap UNUSED)
22482248
virtual_op = MAYBE;
22492249
# endif
22502250

2251-
(void)call_func_retnr(p_opfunc, 1, argv, FALSE);
2251+
(void)call_func_retnr(p_opfunc, 1, argv);
22522252

22532253
# ifdef FEAT_VIRTUALEDIT
22542254
virtual_op = save_virtual_op;

src/proto/eval.pro

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ varnumber_T eval_to_number(char_u *expr);
1919
list_T *eval_spell_expr(char_u *badword, char_u *expr);
2020
int get_spellword(list_T *list, char_u **pp);
2121
typval_T *eval_expr(char_u *arg, char_u **nextcmd);
22-
int call_vim_function(char_u *func, int argc, typval_T *argv, typval_T *rettv, int safe);
23-
varnumber_T call_func_retnr(char_u *func, int argc, typval_T *argv, int safe);
24-
void *call_func_retstr(char_u *func, int argc, typval_T *argv, int safe);
25-
void *call_func_retlist(char_u *func, int argc, typval_T *argv, int safe);
22+
int call_vim_function(char_u *func, int argc, typval_T *argv, typval_T *rettv);
23+
varnumber_T call_func_retnr(char_u *func, int argc, typval_T *argv);
24+
void *call_func_retstr(char_u *func, int argc, typval_T *argv);
25+
void *call_func_retlist(char_u *func, int argc, typval_T *argv);
2626
int eval_foldexpr(char_u *arg, int *cp);
2727
void ex_let(exarg_T *eap);
2828
void list_hashtable_vars(hashtab_T *ht, char_u *prefix, int empty, int *first);

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,8 @@ static char *(features[]) =
794794

795795
static int included_patches[] =
796796
{ /* Add new patch number below this line */
797+
/**/
798+
233,
797799
/**/
798800
232,
799801
/**/

0 commit comments

Comments
 (0)