[lvm-devel] master - cleanup: use unrelated temporary variables

Zdenek Kabelac zkabelac at fedoraproject.org
Sat Jun 15 22:16:29 UTC 2013


Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=636c51ae3f0fda00b38851ead7f419bc834786a4
Commit:        636c51ae3f0fda00b38851ead7f419bc834786a4
Parent:        450ac7be4297012d57880e39261eda726cb75eba
Author:        Zdenek Kabelac <zkabelac at redhat.com>
AuthorDate:    Fri Jun 14 21:49:12 2013 +0200
Committer:     Zdenek Kabelac <zkabelac at redhat.com>
CommitterDate: Sun Jun 16 00:07:33 2013 +0200

cleanup: use unrelated temporary variables

use of tmp_rq2 is unrelated to tmp_rq - so use separate
variable.
---
 daemons/cmirrord/cluster.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/daemons/cmirrord/cluster.c b/daemons/cmirrord/cluster.c
index 70c76c3..f19b2a9 100644
--- a/daemons/cmirrord/cluster.c
+++ b/daemons/cmirrord/cluster.c
@@ -1020,7 +1020,7 @@ static void cpg_message_callback(cpg_handle_t handle, const struct cpg_name *gna
 	int i_am_server;
 	int response = 0;
 	struct clog_request *rq = msg;
-	struct clog_request *tmp_rq;
+	struct clog_request *tmp_rq, *tmp_rq2;
 	struct clog_cpg *match;
 
 	match = find_clog_cpg(handle);
@@ -1151,18 +1151,17 @@ static void cpg_message_callback(cpg_handle_t handle, const struct cpg_name *gna
 
 		if (match->state == INVALID) {
 			LOG_DBG("Log not valid yet, storing request");
-			tmp_rq = malloc(DM_ULOG_REQUEST_SIZE);
-			if (!tmp_rq) {
+			if (!(tmp_rq2 = malloc(DM_ULOG_REQUEST_SIZE))) {
 				LOG_ERROR("cpg_message_callback:  Unable to"
 					  " allocate transfer structs");
 				r = -ENOMEM; /* FIXME: Better error #? */
 				goto out;
 			}
 
-			memcpy(tmp_rq, rq, sizeof(*rq) + rq->u_rq.data_size);
-			tmp_rq->pit_server = match->lowest_id;
-			dm_list_init(&tmp_rq->u.list);
-			dm_list_add(&match->startup_list, &tmp_rq->u.list);
+			memcpy(tmp_rq2, rq, sizeof(*rq) + rq->u_rq.data_size);
+			tmp_rq2->pit_server = match->lowest_id;
+			dm_list_init(&tmp_rq2->u.list);
+			dm_list_add(&match->startup_list, &tmp_rq2->u.list);
 			goto out;
 		}
 




More information about the lvm-devel mailing list