mirror of
https://github.com/neovim/neovim.git
synced 2024-12-31 17:13:26 -07:00
vim-patch:8.1.0053 use typval_T in the caller of call_vim_function
Problem: unreliable types for complete function arguments Solution: fix argument type for functions w/ unreliable type conversion(Ozaki Kiichi) vim/vim#2993
This commit is contained in:
parent
dedcd3ad1e
commit
ea14d8d493
@ -3694,7 +3694,7 @@ expand_by_function (
|
|||||||
curbuf_save = curbuf;
|
curbuf_save = curbuf;
|
||||||
|
|
||||||
// Call a function, which returns a list or dict.
|
// Call a function, which returns a list or dict.
|
||||||
if (call_vim_function(funcname, 2, args, false, &rettv) == OK) {
|
if (call_vim_function(funcname, 2, args, &rettv, false) == OK) {
|
||||||
switch (rettv.v_type) {
|
switch (rettv.v_type) {
|
||||||
case VAR_LIST:
|
case VAR_LIST:
|
||||||
matchlist = rettv.vval.v_list;
|
matchlist = rettv.vval.v_list;
|
||||||
|
@ -1275,7 +1275,7 @@ int get_spellword(list_T *const list, const char **ret_word)
|
|||||||
|
|
||||||
|
|
||||||
// Call some vim script function and return the result in "*rettv".
|
// Call some vim script function and return the result in "*rettv".
|
||||||
// Uses argv[argc-1] for the function arguments. argv[argc]
|
// Uses argv[0] to argv[argc-1] for the function arguments. argv[argc]
|
||||||
// should have type VAR_UNKNOWN.
|
// should have type VAR_UNKNOWN.
|
||||||
//
|
//
|
||||||
// Return OK or FAIL.
|
// Return OK or FAIL.
|
||||||
@ -1283,8 +1283,8 @@ int call_vim_function(
|
|||||||
const char_u *func,
|
const char_u *func,
|
||||||
int argc,
|
int argc,
|
||||||
typval_T *argv,
|
typval_T *argv,
|
||||||
int safe, // use the sandbox
|
typval_T *rettv,
|
||||||
typval_T *rettv
|
bool safe // use the sandbox
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int doesrange;
|
int doesrange;
|
||||||
@ -1325,7 +1325,7 @@ varnumber_T call_func_retnr(char_u *func, int argc,
|
|||||||
typval_T rettv;
|
typval_T rettv;
|
||||||
varnumber_T retval;
|
varnumber_T retval;
|
||||||
|
|
||||||
if (call_vim_function(func, argc, argv, safe, &rettv) == FAIL) {
|
if (call_vim_function(func, argc, argv, &rettv, safe) == FAIL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
retval = tv_get_number_chk(&rettv, NULL);
|
retval = tv_get_number_chk(&rettv, NULL);
|
||||||
@ -1348,7 +1348,7 @@ char *call_func_retstr(const char *const func, int argc,
|
|||||||
{
|
{
|
||||||
typval_T rettv;
|
typval_T rettv;
|
||||||
// All arguments are passed as strings, no conversion to number.
|
// All arguments are passed as strings, no conversion to number.
|
||||||
if (call_vim_function((const char_u *)func, argc, argv, safe, &rettv)
|
if (call_vim_function((const char_u *)func, argc, argv, &rettv, safe)
|
||||||
== FAIL) {
|
== FAIL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -1372,7 +1372,7 @@ void *call_func_retlist(char_u *func, int argc, typval_T *argv,
|
|||||||
typval_T rettv;
|
typval_T rettv;
|
||||||
|
|
||||||
// All arguments are passed as strings, no conversion to number.
|
// All arguments are passed as strings, no conversion to number.
|
||||||
if (call_vim_function(func, argc, argv, safe, &rettv) == FAIL) {
|
if (call_vim_function(func, argc, argv, &rettv, safe) == FAIL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user