[PATCH 03/17] virDomainMomentAssignDef: Simplify error handling

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

 



Remove error handling from the call to 'virDomainMomentObjNew' as it
can't return NULL and replace 'virHashAddEntry' by 'g_hash_table_insert'
as we've already checked that snapshot with such name doesn't exist in
the hash table. This removes handling for two impossible errors.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/conf/virdomainmomentobjlist.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/conf/virdomainmomentobjlist.c b/src/conf/virdomainmomentobjlist.c
index 8993c2310b..2f2467d13f 100644
--- a/src/conf/virdomainmomentobjlist.c
+++ b/src/conf/virdomainmomentobjlist.c
@@ -245,14 +245,9 @@ virDomainMomentAssignDef(virDomainMomentObjList *moments,
         return NULL;
     }

-    if (!(moment = virDomainMomentObjNew()))
-        return NULL;
-
-    if (virHashAddEntry(moments->objs, def->name, moment) < 0) {
-        VIR_FREE(moment);
-        return NULL;
-    }
+    moment = virDomainMomentObjNew();
     moment->def = def;
+    g_hash_table_insert(moments->objs, g_strdup(def->name), moment);

     return moment;
 }
-- 
2.31.1




[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