From 8a46c5df1c1b7d7c2b46b73f973a45388a517e71 Mon Sep 17 00:00:00 2001 From: est31 Date: Sat, 26 Dec 2015 17:01:41 +0100 Subject: 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 --- src/database-redis.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/database-redis.cpp') diff --git a/src/database-redis.cpp b/src/database-redis.cpp index b15f546b2..196d72f25 100644 --- a/src/database-redis.cpp +++ b/src/database-redis.cpp @@ -169,10 +169,12 @@ void Database_Redis::listAllLoadableBlocks(std::vector &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); -- cgit v1.2.3