conf: Introduce virDomainVideoDefClear helper

Future patches rely on the ability to reset the contents of the
virDomainVideoDef structure rather than re-allocating it.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
Erik Skultety 2018-06-28 09:36:26 +02:00
parent 3e90bd67a2
commit f317b1e5c5
3 changed files with 15 additions and 1 deletions

View File

@ -2538,7 +2538,8 @@ virDomainVideoDefNew(void)
}
void virDomainVideoDefFree(virDomainVideoDefPtr def)
void
virDomainVideoDefClear(virDomainVideoDefPtr def)
{
if (!def)
return;
@ -2548,6 +2549,17 @@ void virDomainVideoDefFree(virDomainVideoDefPtr def)
VIR_FREE(def->accel);
VIR_FREE(def->virtio);
VIR_FREE(def->driver);
memset(def, 0, sizeof(*def));
}
void virDomainVideoDefFree(virDomainVideoDefPtr def)
{
if (!def)
return;
virDomainVideoDefClear(def);
VIR_FREE(def);
}

View File

@ -2884,6 +2884,7 @@ void virDomainNVRAMDefFree(virDomainNVRAMDefPtr def);
void virDomainWatchdogDefFree(virDomainWatchdogDefPtr def);
virDomainVideoDefPtr virDomainVideoDefNew(void);
void virDomainVideoDefFree(virDomainVideoDefPtr def);
void virDomainVideoDefClear(virDomainVideoDefPtr def);
virDomainHostdevDefPtr virDomainHostdevDefNew(void);
void virDomainHostdevDefClear(virDomainHostdevDefPtr def);
void virDomainHostdevDefFree(virDomainHostdevDefPtr def);

View File

@ -558,6 +558,7 @@ virDomainTPMModelTypeToString;
virDomainUSBDeviceDefForeach;
virDomainVideoDefaultRAM;
virDomainVideoDefaultType;
virDomainVideoDefClear;
virDomainVideoDefFree;
virDomainVideoDefNew;
virDomainVideoTypeFromString;