From 67e14018917f855fdb848306d0d1d59d72cc3c07 Mon Sep 17 00:00:00 2001 From: Daylily-Zeleen Date: Fri, 14 Apr 2023 15:42:03 +0800 Subject: [PATCH] Set builtin varrarg ptrcalls, called without arg. --- core/variant/variant_call.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/core/variant/variant_call.cpp b/core/variant/variant_call.cpp index ccf9b820227..5a405a7080a 100644 --- a/core/variant/variant_call.cpp +++ b/core/variant/variant_call.cpp @@ -561,8 +561,8 @@ static _FORCE_INLINE_ void vc_ptrcall(void (*method)(T *, P...), void *p_base, c } \ static void ptrcall(void *p_base, const void **p_args, void *r_ret, int p_argcount) { \ LocalVector vars; \ - vars.resize(p_argcount); \ LocalVector vars_ptrs; \ + vars.resize(p_argcount); \ vars_ptrs.resize(p_argcount); \ for (int i = 0; i < p_argcount; i++) { \ vars[i] = PtrToArg::convert(p_args[i]); \ @@ -571,7 +571,7 @@ static _FORCE_INLINE_ void vc_ptrcall(void (*method)(T *, P...), void *p_base, c Variant base = PtrToArg::convert(p_base); \ Variant ret; \ Callable::CallError ce; \ - m_method_ptr(&base, (const Variant **)&vars_ptrs[0], p_argcount, ret, ce); \ + m_method_ptr(&base, vars_ptrs.ptr(), p_argcount, ret, ce); \ if (m_has_return) { \ m_return_type r = ret; \ PtrToArg::encode(ret, r_ret); \ @@ -617,8 +617,8 @@ static _FORCE_INLINE_ void vc_ptrcall(void (*method)(T *, P...), void *p_base, c } \ static void ptrcall(void *p_base, const void **p_args, void *r_ret, int p_argcount) { \ LocalVector vars; \ - vars.resize(p_argcount); \ LocalVector vars_ptrs; \ + vars.resize(p_argcount); \ vars_ptrs.resize(p_argcount); \ for (int i = 0; i < p_argcount; i++) { \ vars[i] = PtrToArg::convert(p_args[i]); \ @@ -627,7 +627,7 @@ static _FORCE_INLINE_ void vc_ptrcall(void (*method)(T *, P...), void *p_base, c Variant base = PtrToArg::convert(p_base); \ Variant ret; \ Callable::CallError ce; \ - m_method_ptr(&base, (const Variant **)&vars_ptrs[0], p_argcount, ret, ce); \ + m_method_ptr(&base, vars_ptrs.ptr(), p_argcount, ret, ce); \ } \ static int get_argument_count() { \ return 1; \ @@ -1132,11 +1132,7 @@ static void register_builtin_method(const Vector &p_argnames, const Vect imi.call = T::call; imi.validated_call = T::validated_call; - if (T::is_vararg()) { - imi.ptrcall = nullptr; - } else { - imi.ptrcall = T::ptrcall; - } + imi.ptrcall = T::ptrcall; imi.default_arguments = p_def_args; imi.argument_names = p_argnames;