Skip to contentSkip to conversation

master - cleanup: more readable code

PATCH Zdenek Kabelac 1 participant 1 message Nov 17, 2015

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6e71d3fbde344c26f8301dbd9550a110d5bc7ac4
Commit:        6e71d3fbde344c26f8301dbd9550a110d5bc7ac4
Parent:        d8049dd17a50b704edea69c968305aee732cb256
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Tue Nov 17 13:15:39 2015 +0100
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Tue Nov 17 19:01:25 2015 +0100

cleanup: more readable code

Simplify if() expression.
Rename 'this' to 'vg'..

---
 lib/cache/lvmetad.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
lib/cache/lvmetad.c +6 -5
index d300d39..dced80a 100644
@@ -1187,16 +1187,17 @@ struct _lvmetad_pvscan_baton {
 static int _lvmetad_pvscan_single(struct metadata_area *mda, void *baton)
 {
 	struct _lvmetad_pvscan_baton *b = baton;
-	struct volume_group *this;
+	struct volume_group *vg;
 
-	if (!(this = mda_is_ignored(mda) ? NULL : mda->ops->vg_read(b->fid, "", mda, NULL, NULL, 1)))
+	if (mda_is_ignored(mda) ||
+	    !(vg = mda->ops->vg_read(b->fid, "", mda, NULL, NULL, 1)))
 		return 1;
 
 	/* FIXME Also ensure contents match etc. */
-	if (!b->vg || this->seqno > b->vg->seqno)
-		b->vg = this;
+	if (!b->vg || vg->seqno > b->vg->seqno)
+		b->vg = vg;
 	else if (b->vg)
-		release_vg(this);
+		release_vg(vg);
 
 	return 1;
 }