1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-02 16:38:41 +00:00

Replace std::list by std::vector into ServerMap::listAllLoadableBlocks ServerMap::listAllLoadedBlocks and their database backends.

This adds a speedup on database migration and /clearobjects command
This commit is contained in:
Loic Blot 2015-02-17 14:30:32 +01:00
parent c58d49977d
commit 718bcafd51
13 changed files with 43 additions and 51 deletions

View file

@ -147,7 +147,7 @@ bool Database_Redis::deleteBlock(v3s16 blockpos)
return true;
}
void Database_Redis::listAllLoadableBlocks(std::list<v3s16> &dst)
void Database_Redis::listAllLoadableBlocks(std::vector<v3s16> &dst)
{
redisReply *reply;
reply = (redisReply*) redisCommand(ctx, "HKEYS %s", hash.c_str());
@ -155,8 +155,7 @@ void Database_Redis::listAllLoadableBlocks(std::list<v3s16> &dst)
throw FileNotGoodException(std::string("redis command 'HKEYS %s' failed: ") + ctx->errstr);
if(reply->type != REDIS_REPLY_ARRAY)
throw FileNotGoodException("Failed to get keys from database");
for(size_t i = 0; i < reply->elements; i++)
{
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)));
}