From: Sami Kerola Date: Mon, 4 Jul 2016 21:12:55 +0000 (+0100) Subject: libblkid: simplify if clause [oclint] X-Git-Tag: v2.29-rc1~143^2~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=92a4d098ce12994756c3a0527786609a83947224;p=thirdparty%2Futil-linux.git libblkid: simplify if clause [oclint] Move negative and positive testing of 'has' variable to top level, and test flag bit mask on second level. This way the 'has' needs to be checked only once. Signed-off-by: Sami Kerola --- diff --git a/libblkid/src/probe.c b/libblkid/src/probe.c index d7a3ba7cf4..43ea4c741e 100644 --- a/libblkid/src/probe.c +++ b/libblkid/src/probe.c @@ -552,13 +552,11 @@ int __blkid_probe_filter_types(blkid_probe pr, int chain, int flag, char *names[ break; } } - if (flag & BLKID_FLTR_ONLYIN) { - if (!has) + if (has) { + if (flag & BLKID_FLTR_NOTIN) blkid_bmp_set_item(fltr, i); - } else if (flag & BLKID_FLTR_NOTIN) { - if (has) - blkid_bmp_set_item(fltr, i); - } + } else if (flag & BLKID_FLTR_ONLYIN) + blkid_bmp_set_item(fltr, i); } DBG(LOWPROBE, ul_debug("%s: a new probing type-filter initialized",