Util-Linux package development
 help / color / mirror / Atom feed
From: Boris Egorov <egorov@linux.com>
To: util-linux@vger.kernel.org
Cc: Boris Egorov <egorov@linux.com>
Subject: [PATCH 2/3] libblkid/whereis: simplify some conditions [cppcheck]
Date: Sat, 20 Jun 2015 01:41:00 +0600	[thread overview]
Message-ID: <1434742861-11704-3-git-send-email-egorov@linux.com> (raw)
In-Reply-To: <1434742861-11704-1-git-send-email-egorov@linux.com>

[misc-utils/whereis.c:466]: (style) Redundant condition: uflag.
'A && (!A || B)' is equivalent to 'A || B'
[libblkid/src/tag.c:373]: (style) Redundant condition: dev.
'A && (!A || B)' is equivalent to 'A || B'

Signed-off-by: Boris Egorov <egorov@linux.com>
---
 libblkid/src/tag.c   | 2 +-
 misc-utils/whereis.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libblkid/src/tag.c b/libblkid/src/tag.c
index 6af8062..281612a 100644
--- a/libblkid/src/tag.c
+++ b/libblkid/src/tag.c
@@ -370,7 +370,7 @@ try_again:
 	}
 	if (dev && !(dev->bid_flags & BLKID_BID_FL_VERIFIED)) {
 		dev = blkid_verify(cache, dev);
-		if (!dev || (dev && (dev->bid_flags & BLKID_BID_FL_VERIFIED)))
+		if (!dev || dev->bid_flags & BLKID_BID_FL_VERIFIED)
 			goto try_again;
 	}
 
diff --git a/misc-utils/whereis.c b/misc-utils/whereis.c
index 96a930e..697d666 100644
--- a/misc-utils/whereis.c
+++ b/misc-utils/whereis.c
@@ -463,7 +463,7 @@ static void lookup(const char *pattern, struct wh_dirlist *ls, int want)
 
 	free(wait);
 
-	if (!uflag || (uflag && count > 1))
+	if (!uflag || count > 1)
 		putchar('\n');
 	return;
 }
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in

  parent reply	other threads:[~2015-06-19 19:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-19 19:40 [PATCH 0/3] cppcheck warnings fixes Boris Egorov
2015-06-19 19:40 ` [PATCH 1/3] sys-utils/disk-utils/lib: fix printf format types [cppcheck] Boris Egorov
2015-06-19 19:41 ` Boris Egorov [this message]
2015-06-19 19:41 ` [PATCH 3/3] cfdisk: fix condition logic [cppcheck] Boris Egorov
2015-06-25 10:10 ` [PATCH 0/3] cppcheck warnings fixes Karel Zak

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=1434742861-11704-3-git-send-email-egorov@linux.com \
    --to=egorov@linux.com \
    --cc=util-linux@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox