diff options
author | Marcel Admiraal <madmiraal@users.noreply.github.com> | 2021-05-21 13:04:55 +0100 |
---|---|---|
committer | Marcel Admiraal <madmiraal@users.noreply.github.com> | 2021-05-21 13:04:55 +0100 |
commit | afdc5edb2a9d3805b2e5d9bf1b3d998b83e0ea85 (patch) | |
tree | 1927e702d7222d0e0deb1604c08556956ac32e2f /core/variant | |
parent | e773bf56edef87de70c48515cdbe01340ef80b13 (diff) |
Remove alloca from loop and use a single fixed size array declaration
Diffstat (limited to 'core/variant')
-rw-r--r-- | core/variant/array.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/variant/array.cpp b/core/variant/array.cpp index 3c7e2a0719..09cf785390 100644 --- a/core/variant/array.cpp +++ b/core/variant/array.cpp @@ -366,8 +366,8 @@ Array Array::filter(const Callable &p_callable) const { new_arr.resize(size()); int accepted_count = 0; + const Variant *argptrs[1]; for (int i = 0; i < size(); i++) { - const Variant **argptrs = (const Variant **)alloca(sizeof(Variant *)); argptrs[0] = &get(i); Variant result; @@ -392,8 +392,8 @@ Array Array::map(const Callable &p_callable) const { Array new_arr; new_arr.resize(size()); + const Variant *argptrs[1]; for (int i = 0; i < size(); i++) { - const Variant **argptrs = (const Variant **)alloca(sizeof(Variant *)); argptrs[0] = &get(i); Variant result; @@ -417,8 +417,8 @@ Variant Array::reduce(const Callable &p_callable, const Variant &p_accum) const start = 1; } + const Variant *argptrs[2]; for (int i = start; i < size(); i++) { - const Variant **argptrs = (const Variant **)alloca(sizeof(Variant *) * 2); argptrs[0] = &ret; argptrs[1] = &get(i); |