mirror of
https://github.com/Redot-Engine/redot-engine.git
synced 2025-12-06 15:21:56 -05:00
Preallocate vectors with known size.
This commit is contained in:
@@ -428,8 +428,9 @@ public:
|
||||
option.location = op["location"];
|
||||
if (op.has("matches")) {
|
||||
PackedInt32Array matches = op["matches"];
|
||||
ERR_CONTINUE(matches.size() & 1);
|
||||
for (int j = 0; j < matches.size(); j += 2) {
|
||||
size_t matches_size = matches.size();
|
||||
ERR_CONTINUE(matches_size & 1);
|
||||
for (size_t j = 0; j < matches_size; j += 2) {
|
||||
option.matches.push_back(Pair<int, int>(matches[j], matches[j + 1]));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user