From 6b35b883131f09922252c44c66b8a37c920a0af4 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Tue, 25 Sep 2012 14:13:54 -0700 Subject: [PATCH] DBObjectMap::_get_header fix shadowed var causing dead code CID 716897: Logically dead code (DEADCODE)At (5): Execution cannot reach this statement "return r;". The outer r was shadowed. Instead, just return the error code from the loop. Signed-off-by: Samuel Just --- src/os/DBObjectMap.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/os/DBObjectMap.cc b/src/os/DBObjectMap.cc index dd9f218b5b901..83b746d80e99b 100644 --- a/src/os/DBObjectMap.cc +++ b/src/os/DBObjectMap.cc @@ -550,23 +550,22 @@ int DBObjectMap::get_header(const hobject_t &hoid, int DBObjectMap::_get_header(Header header, bufferlist *bl) { - int r = 0; map out; - while (r == 0) { + while (true) { out.clear(); set to_get; to_get.insert(USER_HEADER_KEY); int r = db->get(sys_prefix(header), to_get, &out); if (r == 0 && out.size()) break; + if (r < 0) + return r; Header current(header); if (!current->parent) break; header = lookup_parent(current); } - if (r < 0) - return r; if (out.size()) bl->swap(out.begin()->second); return 0; -- 2.39.5