mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
libxl: eliminate extra copy of string
libxlMakeNic was calling g_strdup(virBufferCurrentContent(&buf)) to make a copy of the buffer contents, and then later freeing the buffer without ever using it again. Instead of this extra strdup, just transfer ownership of the virBuffer's string with virBufferContentAndReset(), and be done with it. Signed-off-by: Laine Stump <laine@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
065f7d5ba9
commit
84fddfed45
@ -1335,7 +1335,7 @@ libxlMakeNic(virDomainDefPtr def,
|
||||
}
|
||||
}
|
||||
}
|
||||
x_nic->bridge = g_strdup(virBufferCurrentContent(&buf));
|
||||
x_nic->bridge = virBufferContentAndReset(&buf);
|
||||
G_GNUC_FALLTHROUGH;
|
||||
case VIR_DOMAIN_NET_TYPE_ETHERNET:
|
||||
x_nic->script = g_strdup(script);
|
||||
|
Loading…
x
Reference in New Issue
Block a user