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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
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;
}