On 01/11/2013 10:00 AM, Peter Krempa wrote: > With this change it's easy to spot a forgotten free if a new device > class is added. > --- > src/conf/domain_conf.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) ACK; and this can go in pre-release. > - switch (def->type) { > + switch ((virDomainDeviceType) def->type) { > case VIR_DOMAIN_DEVICE_DISK: > virDomainDiskDefFree(def->data.disk); > break; > @@ -1562,6 +1562,13 @@ void virDomainDeviceDefFree(virDomainDeviceDefPtr def) > case VIR_DOMAIN_DEVICE_REDIRDEV: > virDomainRedirdevDefFree(def->data.redirdev); > break; > + case VIR_DOMAIN_DEVICE_NONE: > + case VIR_DOMAIN_DEVICE_FS: > + case VIR_DOMAIN_DEVICE_SMARTCARD: > + case VIR_DOMAIN_DEVICE_CHR: > + case VIR_DOMAIN_DEVICE_MEMBALLOON: > + case VIR_DOMAIN_DEVICE_LAST: > + break; > } In general, this style is useful on ANY switch statement over a set of enums, for letting the compiler help us know when the enumeration grew. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list