[sheepdog] [PATCH 03/10] http/kv: clear performance tips generated by cppcheck

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


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

[sheep/http/kv.c:852] -> [sheep/http/kv.c:854]: (performance) Variable
'ret' is reassigned a value before the old one has been used.
[sheep/http/kv.c:919] -> [sheep/http/kv.c:923]: (performance) Variable
'ret' is reassigned a value before the old one has been used.
[sheep/http/kv.c:1242] -> [sheep/http/kv.c:1245]: (performance) Variable
'ret' is reassigned a value before the old one has been used.
[sheep/http/kv.c:1299] -> [sheep/http/kv.c:1303]: (performance) Variable
'ret' is reassigned a value before the old one has been used.

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

diff --git a/sheep/http/kv.c b/sheep/http/kv.c
index 246d4b5..04ee462 100644
--- a/sheep/http/kv.c
+++ b/sheep/http/kv.c
@@ -849,7 +849,7 @@ out:
 
 static int onode_append_data(struct kv_onode *onode, struct http_request *req)
 {
-	int ret = SD_RES_SUCCESS;
+	int ret;
 
 	ret = onode_allocate_extents(onode, req);
 	if (ret != SD_RES_SUCCESS)
@@ -916,7 +916,7 @@ out:
 static int onode_populate_append_data(struct kv_onode *onode,
 				      struct http_request *req)
 {
-	int ret = SD_RES_SUCCESS;
+	int ret;
 
 	onode->mtime = get_seconds();
 
@@ -1239,7 +1239,7 @@ static int onode_allocate_space(struct http_request *req, const char *account,
 {
 	char vdi_name[SD_MAX_VDI_LEN];
 	uint32_t data_vid;
-	int ret = SD_RES_SUCCESS;
+	int ret;
 
 	sys->cdrv->lock(bucket_vid);
 	ret = onode_lookup_nolock(onode, bucket_vid, name);
@@ -1296,7 +1296,7 @@ static int onode_append_space(struct http_request *req, const char *account,
 	char vdi_name[SD_MAX_VDI_LEN];
 	uint32_t data_vid;
 	uint64_t len;
-	int ret = SD_RES_SUCCESS;
+	int ret;
 	bool object_exists = false;
 
 	sys->cdrv->lock(bucket_vid);
-- 
1.8.3.2





More information about the sheepdog mailing list