[sheepdog] [PATCH 07/10] sheep/ops: clear performance tips generated by cppcheck

Ruoyu liangry at ucweb.com
Tue Sep 2 11:14:10 CEST 2014


This patch gets rid of the below messages while performing a code
analysis with cppcheck.

[sheep/ops.c:884] -> [sheep/ops.c:888]: (performance) Variable 'ret' is
reassigned a value before the old one has been used.
[sheep/ops.c:1149] -> [sheep/ops.c:1166]: (performance) Variable
'locked' is reassigned a value before the old one has been used.

Signed-off-by: Ruoyu <liangry at ucweb.com>
---
 sheep/ops.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sheep/ops.c b/sheep/ops.c
index 7247b83..9eb3280 100644
--- a/sheep/ops.c
+++ b/sheep/ops.c
@@ -881,7 +881,7 @@ static int local_discard_obj(struct request *req)
 {
 	uint64_t oid = req->rq.obj.oid;
 	uint32_t vid = oid_to_vid(oid), tmp_vid;
-	int ret = SD_RES_SUCCESS, idx = data_oid_to_idx(oid);
+	int ret, idx = data_oid_to_idx(oid);
 	struct sd_inode *inode = xmalloc(sizeof(struct sd_inode));
 
 	sd_debug("%"PRIx64, oid);
@@ -1146,7 +1146,7 @@ int peer_decref_object(struct request *req)
 	uint32_t generation = hdr->ref.generation;
 	uint32_t count = hdr->ref.count;
 	uint32_t *ledger = NULL;
-	bool exist = false, locked = false;
+	bool exist = false, locked;
 	static struct sd_mutex lock = SD_MUTEX_INITIALIZER;
 
 	sd_debug("%" PRIx64 ", %" PRIu32 ", %" PRIu32 ", %" PRIu32,
-- 
1.8.3.2





More information about the sheepdog mailing list