git » nmdb » commit b600372

Remove unused assignments

author Alberto Bertogli
2010-10-06 16:36:29 UTC
committer Alberto Bertogli
2010-10-06 16:36:29 UTC
parent de84b542a8feae6eb3c770631858746a056d8361

Remove unused assignments

The assignments in this patch were unused or not really needed, so they were
removed to improve clarity.

They were caught by the clang-analyzer tool.

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>

nmdb/parse.c +2 -8
utils/nmdb-stats.c +0 -1

diff --git a/nmdb/parse.c b/nmdb/parse.c
index 3456426..fb667fe 100644
--- a/nmdb/parse.c
+++ b/nmdb/parse.c
@@ -33,14 +33,13 @@ static struct queue_entry *make_queue_long_entry(const struct req_info *req,
 	struct queue_entry *e;
 	unsigned char *kcopy, *vcopy, *nvcopy;
 
-	kcopy = vcopy = nvcopy = NULL;
-
 	e = queue_entry_create();
 	if (e == NULL) {
 		return NULL;
 	}
 
-	kcopy = NULL;
+	kcopy = vcopy = nvcopy = NULL;
+
 	if (key != NULL) {
 		kcopy = malloc(ksize);
 		if (kcopy == NULL)
@@ -48,7 +47,6 @@ static struct queue_entry *make_queue_long_entry(const struct req_info *req,
 		memcpy(kcopy, key, ksize);
 	}
 
-	vcopy = NULL;
 	if (val != NULL) {
 		vcopy = malloc(vsize);
 		if (vcopy == NULL)
@@ -56,7 +54,6 @@ static struct queue_entry *make_queue_long_entry(const struct req_info *req,
 		memcpy(vcopy, val, vsize);
 	}
 
-	nvcopy = NULL;
 	if (newval != NULL) {
 		nvcopy = malloc(nvsize);
 		if (nvcopy == NULL)
@@ -548,12 +545,9 @@ static void parse_incr(struct req_info *req)
 static void parse_firstkey(struct req_info *req)
 {
 	int rv;
-	const unsigned char *key;
 
 	stats.db_firstkey++;
 
-	key = req->payload + sizeof(uint32_t);
-
 	rv = put_in_queue(req, REQ_FIRSTKEY, 1, NULL, 0, NULL, 0);
 	if (!rv) {
 		req->reply_err(req, ERR_MEM);
diff --git a/utils/nmdb-stats.c b/utils/nmdb-stats.c
index be5733e..f3cd6f2 100644
--- a/utils/nmdb-stats.c
+++ b/utils/nmdb-stats.c
@@ -103,7 +103,6 @@ int main(int argc, char **argv)
 	/* The following assumes it can be more than one server. This can
 	 * never happen with the current code, but it can be useful as an
 	 * example in the future. */
-	j = 0;
 	for (i = 0; i < nservers; i++) {
 		printf("stats for server %d:\n", i);