Merge pull request #48926 from madmiraal/fix-38645

Remove alloca from loop and use a single fixed size array declaration
This commit is contained in:
Rémi Verschelde 2021-05-21 19:04:15 +02:00 committed by GitHub
commit 31bd2ccb44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -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);