From 718bcafd5174690a7731f9b04873e9a09f7a47b7 Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Tue, 17 Feb 2015 14:30:32 +0100 Subject: 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 --- src/database-redis.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/database-redis.cpp') diff --git a/src/database-redis.cpp b/src/database-redis.cpp index b086f899d..0962e97ba 100644 --- a/src/database-redis.cpp +++ b/src/database-redis.cpp @@ -147,7 +147,7 @@ bool Database_Redis::deleteBlock(v3s16 blockpos) return true; } -void Database_Redis::listAllLoadableBlocks(std::list &dst) +void Database_Redis::listAllLoadableBlocks(std::vector &dst) { redisReply *reply; reply = (redisReply*) redisCommand(ctx, "HKEYS %s", hash.c_str()); @@ -155,8 +155,7 @@ void Database_Redis::listAllLoadableBlocks(std::list &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))); } -- cgit v1.2.3