mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-02 16:38:41 +00:00
Database backends: fix bug, and small speedup
-> Redis backend: break from switch to fix bug -> Dummy and redis backends: reserve the count so that creating the list is faster
This commit is contained in:
parent
382ab969d4
commit
8a46c5df1c
2 changed files with 3 additions and 0 deletions
|
@ -169,10 +169,12 @@ void Database_Redis::listAllLoadableBlocks(std::vector<v3s16> &dst)
|
|||
}
|
||||
switch (reply->type) {
|
||||
case REDIS_REPLY_ARRAY:
|
||||
dst.reserve(reply->elements);
|
||||
for (size_t i = 0; i < reply->elements; i++) {
|
||||
assert(reply->element[i]->type == REDIS_REPLY_STRING);
|
||||
dst.push_back(getIntegerAsBlock(stoi64(reply->element[i]->str)));
|
||||
}
|
||||
break;
|
||||
case REDIS_REPLY_ERROR:
|
||||
throw FileNotGoodException(std::string(
|
||||
"Failed to get keys from database: ") + reply->str);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue