All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: main - libdm: simplify line emitter checking
Date: Wed, 10 Feb 2021 14:43:59 +0000 (GMT)	[thread overview]
Message-ID: <20210210144359.52404385DC33@sourceware.org> (raw)

Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=82bffa99ada0173704739b6fff856a3d6cb5455d
Commit:        82bffa99ada0173704739b6fff856a3d6cb5455d
Parent:        4b371246f52d2b3296ec27467a15a35a18b40542
Author:        Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate:    Wed Feb 10 15:10:28 2021 +0100
Committer:     Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Wed Feb 10 15:39:03 2021 +0100

libdm: simplify line emitter checking

---
 libdm/libdm-deptree.c | 20 ++++++++------------
 libdm/libdm-report.c  |  2 +-
 2 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index 336cbb696..bf027ee81 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -2231,7 +2231,7 @@ static int _mirror_emit_segment_line(struct dm_task *dmt, struct load_segment *s
 
 	EMIT_PARAMS(pos, " %u ", seg->mirror_area_count);
 
-	if (_emit_areas_line(dmt, seg, params, paramsize, &pos) <= 0)
+	if (!_emit_areas_line(dmt, seg, params, paramsize, &pos))
 		return_0;
 
 	if (handle_errors)
@@ -2433,7 +2433,7 @@ static int _raid_emit_segment_line(struct dm_task *dmt, uint32_t major,
 	/* Print number of metadata/data device pairs */
 	EMIT_PARAMS(pos, " %u", area_count);
 
-	if (_emit_areas_line(dmt, seg, params, paramsize, &pos) <= 0)
+	if (!_emit_areas_line(dmt, seg, params, paramsize, &pos))
 		return_0;
 
 	return 1;
@@ -2561,7 +2561,6 @@ static int _emit_segment_line(struct dm_task *dmt, uint32_t major,
 			      size_t paramsize)
 {
 	int pos = 0;
-	int r;
 	int target_type_is_raid = 0;
 	char originbuf[DM_FORMAT_DEV_BUFSIZE], cowbuf[DM_FORMAT_DEV_BUFSIZE];
 
@@ -2572,8 +2571,7 @@ static int _emit_segment_line(struct dm_task *dmt, uint32_t major,
 		break;
 	case SEG_MIRRORED:
 		/* Mirrors are pretty complicated - now in separate function */
-		r = _mirror_emit_segment_line(dmt, seg, params, paramsize);
-		if (!r)
+		if (!_mirror_emit_segment_line(dmt, seg, params, paramsize))
 			return_0;
 		break;
 	case SEG_SNAPSHOT:
@@ -2619,9 +2617,8 @@ static int _emit_segment_line(struct dm_task *dmt, uint32_t major,
 	case SEG_RAID6_LA_6:
 	case SEG_RAID6_RA_6:
 		target_type_is_raid = 1;
-		r = _raid_emit_segment_line(dmt, major, minor, seg, seg_start,
-					    params, paramsize);
-		if (!r)
+		if (!_raid_emit_segment_line(dmt, major, minor, seg, seg_start,
+					     params, paramsize))
 			return_0;
 
 		break;
@@ -2652,10 +2649,9 @@ static int _emit_segment_line(struct dm_task *dmt, uint32_t major,
 	case SEG_CRYPT:
 	case SEG_LINEAR:
 	case SEG_STRIPED:
-		if ((r = _emit_areas_line(dmt, seg, params, paramsize, &pos)) <= 0) {
-			stack;
-			return r;
-		}
+		if (!_emit_areas_line(dmt, seg, params, paramsize, &pos))
+			return_0;
+
 		if (!params[0]) {
 			log_error("No parameters supplied for %s target "
 				  "%u:%u.", _dm_segtypes[seg->type].target,
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index b0c89ab61..a1c07badd 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -491,7 +491,7 @@ static int _report_field_string_list(struct dm_report *rh,
 		delimiter = ",";
 	delimiter_len = strlen(delimiter);
 
-	i = pos = len = 0;
+	i = pos = 0;
 	dm_list_iterate_items(sl, data) {
 		arr[i].str = sl->str;
 		if (!sort) {



                 reply	other threads:[~2021-02-10 14:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210210144359.52404385DC33@sourceware.org \
    --to=zkabelac@sourceware.org \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.