mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 06:50:22 +03:00
netdev_bandwidth_conf: Refractor virNetDevBandwidthParse()
Refractoring includes: * removal of VIR_FREE * inversion of the condition Signed-off-by: Kristina Hanicova <khanicov@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
a40448c42f
commit
bcb63a3bdc
@ -111,7 +111,7 @@ virNetDevBandwidthParse(virNetDevBandwidthPtr *bandwidth,
|
||||
bool allowFloor)
|
||||
{
|
||||
int ret = -1;
|
||||
virNetDevBandwidthPtr def = NULL;
|
||||
g_autoptr(virNetDevBandwidth) def = NULL;
|
||||
xmlNodePtr cur;
|
||||
xmlNodePtr in = NULL, out = NULL;
|
||||
g_autofree char *class_id_prop = NULL;
|
||||
@ -197,14 +197,12 @@ virNetDevBandwidthParse(virNetDevBandwidthPtr *bandwidth,
|
||||
}
|
||||
}
|
||||
|
||||
if (!def->in && !def->out)
|
||||
VIR_FREE(def);
|
||||
if (def->in || def->out)
|
||||
*bandwidth = g_steal_pointer(&def);
|
||||
|
||||
*bandwidth = g_steal_pointer(&def);
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
virNetDevBandwidthFree(def);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,8 @@ struct _virNetDevBandwidth {
|
||||
|
||||
void virNetDevBandwidthFree(virNetDevBandwidthPtr def);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virNetDevBandwidth, virNetDevBandwidthFree);
|
||||
|
||||
int virNetDevBandwidthSet(const char *ifname,
|
||||
const virNetDevBandwidth *bandwidth,
|
||||
bool hierarchical_class,
|
||||
|
Loading…
x
Reference in New Issue
Block a user