[libvirt PATCH 1/4] tools: snapshot: remove pointless checks

Ján Tomko jtomko at redhat.com
Fri Apr 1 13:27:33 UTC 2022


There's no need to check whether a flag is not set just to set it
in that case.

Signed-off-by: Ján Tomko <jtomko at redhat.com>
---
 tools/virsh-snapshot.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
index 9ed64313af..7cd76f39e2 100644
--- a/tools/virsh-snapshot.c
+++ b/tools/virsh-snapshot.c
@@ -1292,10 +1292,9 @@ virshSnapshotListCollect(vshControl *ctl, virDomainPtr dom,
     if (filter_fallback) {
         /* Older API didn't filter on status or location, but the
          * information is available in domain XML.  */
-        if (!(orig_flags & VIR_DOMAIN_SNAPSHOT_FILTERS_STATUS))
-            orig_flags |= VIR_DOMAIN_SNAPSHOT_FILTERS_STATUS;
-        if (!(orig_flags & VIR_DOMAIN_SNAPSHOT_FILTERS_LOCATION))
-            orig_flags |= VIR_DOMAIN_SNAPSHOT_FILTERS_LOCATION;
+        orig_flags |= VIR_DOMAIN_SNAPSHOT_FILTERS_STATUS;
+        orig_flags |= VIR_DOMAIN_SNAPSHOT_FILTERS_LOCATION;
+
         for (i = 0; i < snaplist->nsnaps; i++) {
             switch (virshSnapshotFilter(ctl, snaplist->snaps[i].snap,
                                         orig_flags)) {
-- 
2.34.1



More information about the libvir-list mailing list