mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
virDomainMomentAssignDef: Simplify error handling
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>
This commit is contained in:
parent
abf9eac87c
commit
ebfe9b1a15
@ -245,14 +245,9 @@ virDomainMomentAssignDef(virDomainMomentObjList *moments,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(moment = virDomainMomentObjNew()))
|
moment = virDomainMomentObjNew();
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (virHashAddEntry(moments->objs, def->name, moment) < 0) {
|
|
||||||
VIR_FREE(moment);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
moment->def = def;
|
moment->def = def;
|
||||||
|
g_hash_table_insert(moments->objs, g_strdup(def->name), moment);
|
||||||
|
|
||||||
return moment;
|
return moment;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user