]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: simplify if clause [oclint]
authorSami Kerola <kerolasa@iki.fi>
Mon, 4 Jul 2016 21:12:55 +0000 (22:12 +0100)
committerSami Kerola <kerolasa@iki.fi>
Thu, 21 Jul 2016 20:14:33 +0000 (21:14 +0100)
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 <kerolasa@iki.fi>
libblkid/src/probe.c

index d7a3ba7cf4a1fd17cb2140345fc627d950334e3d..43ea4c741ed726d5b643cca204f0a65d02da92dc 100644 (file)
@@ -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",