[PATCH v7 02/23] snapshot: Allow NULL to virDomainSnapshotObjGetDef

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Doing so can simplify some callers.

Signed-off-by: Eric Blake <eblake@xxxxxxxxxx>
---
 src/conf/virdomainsnapshotobjlist.h | 2 +-
 src/conf/snapshot_conf.c            | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/conf/virdomainsnapshotobjlist.h b/src/conf/virdomainsnapshotobjlist.h
index b83f7a4ba9..12b574b4ff 100644
--- a/src/conf/virdomainsnapshotobjlist.h
+++ b/src/conf/virdomainsnapshotobjlist.h
@@ -87,7 +87,7 @@ int virDomainListSnapshots(virDomainSnapshotObjListPtr snapshots,
 static inline virDomainSnapshotDefPtr
 virDomainSnapshotObjGetDef(virDomainMomentObjPtr obj)
 {
-    return (virDomainSnapshotDefPtr) obj->def;
+    return obj ? (virDomainSnapshotDefPtr) obj->def : NULL;
 }

 #endif /* LIBVIRT_VIRDOMAINSNAPSHOTOBJLIST_H */
diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index 4ce120451e..8e4f3d9410 100644
--- a/src/conf/snapshot_conf.c
+++ b/src/conf/snapshot_conf.c
@@ -967,7 +967,7 @@ virDomainSnapshotRedefinePrep(virDomainPtr domain,
     }

     other = virDomainSnapshotFindByName(vm->snapshots, def->common.name);
-    otherdef = other ? virDomainSnapshotObjGetDef(other) : NULL;
+    otherdef = virDomainSnapshotObjGetDef(other);
     check_if_stolen = other && otherdef->common.dom;
     if (virDomainSnapshotRedefineValidate(def, domain->uuid, other, xmlopt,
                                           flags) < 0) {
-- 
2.20.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux