Re: [PATCH] esx: Reduce code duplication in generator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/01/2013 12:44 PM, Matthias Bolte wrote:
> ---
>  src/esx/esx_vi_generator.py |  430 ++++++++++++-------------------------------
>  1 file changed, 118 insertions(+), 312 deletions(-)

My python is weak, so I reviewed this by comparing the generated files
before and after this patch; added comments in the generated code are
nice, but there are also some added frees.  Are these additions
intentional to fix a leak, or are they representing a bug in your patch?
 If intentional, then this is 1.0.5 material if you improve the commit
message and push in time; if accidental and no real bug is being fixed,
then a v2 should wait until after the release.

Here's the difference in generated files:

diff -ur src/esx.bak/esx_vi_types.generated.c
src/esx/esx_vi_types.generated.c
--- src/esx.bak/esx_vi_types.generated.c	2013-05-01 21:20:40.749653184 -0600
+++ src/esx/esx_vi_types.generated.c	2013-05-01 21:21:43.270214170 -0600
@@ -515,6 +515,7 @@
 /* esxVI_DatastoreInfo_Free */
 ESX_VI__TEMPLATE__DYNAMIC_FREE(DatastoreInfo,
 {
+    /* DatastoreInfo */
     ESX_VI__TEMPLATE__DISPATCH__FREE(LocalDatastoreInfo)
     ESX_VI__TEMPLATE__DISPATCH__FREE(NasDatastoreInfo)
     ESX_VI__TEMPLATE__DISPATCH__FREE(VmfsDatastoreInfo)
@@ -583,7 +584,11 @@
 /* esxVI_Description_Free */
 ESX_VI__TEMPLATE__DYNAMIC_FREE(Description,
 {
+    /* Description */
     ESX_VI__TEMPLATE__DISPATCH__FREE(ElementDescription)
+
+    /* ElementDescription */
+    ESX_VI__TEMPLATE__DISPATCH__FREE(ExtendedElementDescription)
 },
 {
     esxVI_Description_Free(&item->_next);
@@ -739,6 +744,7 @@
 /* esxVI_ElementDescription_Free */
 ESX_VI__TEMPLATE__DYNAMIC_FREE(ElementDescription,
 {
+    /* ElementDescription */
     ESX_VI__TEMPLATE__DISPATCH__FREE(ExtendedElementDescription)
 },
 {
@@ -808,6 +814,7 @@
 /* esxVI_EntityEventArgument_Free */
 ESX_VI__TEMPLATE__DYNAMIC_FREE(EntityEventArgument,
 {
+    /* EntityEventArgument */
     ESX_VI__TEMPLATE__DISPATCH__FREE(VmEventArgument)
 },
 {
@@ -855,7 +862,11 @@
 /* esxVI_EventArgument_Free */
 ESX_VI__TEMPLATE__DYNAMIC_FREE(EventArgument,
 {
+    /* EventArgument */
     ESX_VI__TEMPLATE__DISPATCH__FREE(EntityEventArgument)
+
+    /* EntityEventArgument */
+    ESX_VI__TEMPLATE__DISPATCH__FREE(VmEventArgument)
 },
 {
     /* no properties */
@@ -1018,6 +1029,7 @@
 /* esxVI_FileInfo_Free */
 ESX_VI__TEMPLATE__DYNAMIC_FREE(FileInfo,
 {
+    /* FileInfo */
     ESX_VI__TEMPLATE__DISPATCH__FREE(FloppyImageFileInfo)
     ESX_VI__TEMPLATE__DISPATCH__FREE(FolderFileInfo)
     ESX_VI__TEMPLATE__DISPATCH__FREE(IsoImageFileInfo)
@@ -1026,6 +1038,9 @@
     ESX_VI__TEMPLATE__DISPATCH__FREE(VmLogFileInfo)
     ESX_VI__TEMPLATE__DISPATCH__FREE(VmNvramFileInfo)
     ESX_VI__TEMPLATE__DISPATCH__FREE(VmSnapshotFileInfo)
+
+    /* VmConfigFileInfo */
+    ESX_VI__TEMPLATE__DISPATCH__FREE(TemplateConfigFileInfo)
 },
 {
     esxVI_FileInfo_Free(&item->_next);
@@ -1108,6 +1123,7 @@
 /* esxVI_FileQuery_Free */
 ESX_VI__TEMPLATE__DYNAMIC_FREE(FileQuery,
 {
+    /* FileQuery */
     ESX_VI__TEMPLATE__DISPATCH__FREE(FloppyImageFileQuery)
     ESX_VI__TEMPLATE__DISPATCH__FREE(FolderFileQuery)
     ESX_VI__TEMPLATE__DISPATCH__FREE(IsoImageFileQuery)
@@ -1116,6 +1132,9 @@
     ESX_VI__TEMPLATE__DISPATCH__FREE(VmLogFileQuery)
     ESX_VI__TEMPLATE__DISPATCH__FREE(VmNvramFileQuery)
     ESX_VI__TEMPLATE__DISPATCH__FREE(VmSnapshotFileQuery)
+
+    /* VmConfigFileQuery */
+    ESX_VI__TEMPLATE__DISPATCH__FREE(TemplateConfigFileQuery)
 },
 {
     esxVI_FileQuery_Free(&item->_next);
@@ -1822,7 +1841,11 @@
 /* esxVI_HostDevice_Free */
 ESX_VI__TEMPLATE__DYNAMIC_FREE(HostDevice,
 {
+    /* HostDevice */
     ESX_VI__TEMPLATE__DISPATCH__FREE(ScsiLun)
+
+    /* ScsiLun */
+    ESX_VI__TEMPLATE__DISPATCH__FREE(HostScsiDisk)
 },
 {
     esxVI_HostDevice_Free(&item->_next);
@@ -2104,6 +2127,7 @@
 /* esxVI_HostFileSystemVolume_Free */
 ESX_VI__TEMPLATE__DYNAMIC_FREE(HostFileSystemVolume,
 {
+    /* HostFileSystemVolume */
     ESX_VI__TEMPLATE__DISPATCH__FREE(HostNasVolume)
     ESX_VI__TEMPLATE__DISPATCH__FREE(HostVmfsVolume)
 },
@@ -2150,6 +2174,7 @@
 /* esxVI_HostHostBusAdapter_Free */
 ESX_VI__TEMPLATE__DYNAMIC_FREE(HostHostBusAdapter,
 {
+    /* HostHostBusAdapter */
     ESX_VI__TEMPLATE__DISPATCH__FREE(HostBlockHba)
     ESX_VI__TEMPLATE__DISPATCH__FREE(HostFibreChannelHba)
     ESX_VI__TEMPLATE__DISPATCH__FREE(HostInternetScsiHba)
@@ -4153,6 +4178,7 @@
 /* esxVI_HostTargetTransport_Free */
 ESX_VI__TEMPLATE__DYNAMIC_FREE(HostTargetTransport,
 {
+    /* HostTargetTransport */
     ESX_VI__TEMPLATE__DISPATCH__FREE(HostBlockAdapterTargetTransport)
     ESX_VI__TEMPLATE__DISPATCH__FREE(HostFibreChannelTargetTransport)
     ESX_VI__TEMPLATE__DISPATCH__FREE(HostInternetScsiTargetTransport)
@@ -4459,6 +4485,7 @@
 /* esxVI_HostVirtualSwitchBridge_Free */
 ESX_VI__TEMPLATE__DYNAMIC_FREE(HostVirtualSwitchBridge,
 {
+    /* HostVirtualSwitchBridge */
     ESX_VI__TEMPLATE__DISPATCH__FREE(HostVirtualSwitchAutoBridge)
     ESX_VI__TEMPLATE__DISPATCH__FREE(HostVirtualSwitchBondBridge)
     ESX_VI__TEMPLATE__DISPATCH__FREE(HostVirtualSwitchSimpleBridge)
@@ -5147,6 +5174,7 @@
 /* esxVI_OptionType_Free */
 ESX_VI__TEMPLATE__DYNAMIC_FREE(OptionType,
 {
+    /* OptionType */
     ESX_VI__TEMPLATE__DISPATCH__FREE(ChoiceOption)
 },
 {
@@ -5182,6 +5210,7 @@
 /* esxVI_OptionValue_Free */
 ESX_VI__TEMPLATE__DYNAMIC_FREE(OptionValue,
 {
+    /* OptionValue */
     ESX_VI__TEMPLATE__DISPATCH__FREE(HostInternetScsiHbaParamValue)
 },
 {
@@ -5358,6 +5387,7 @@
 /* esxVI_PerfEntityMetricBase_Free */
 ESX_VI__TEMPLATE__DYNAMIC_FREE(PerfEntityMetricBase,
 {
+    /* PerfEntityMetricBase */
     ESX_VI__TEMPLATE__DISPATCH__FREE(PerfEntityMetric)
 },
 {
@@ -5512,6 +5542,7 @@
 /* esxVI_PerfMetricSeries_Free */
 ESX_VI__TEMPLATE__DYNAMIC_FREE(PerfMetricSeries,
 {
+    /* PerfMetricSeries */
     ESX_VI__TEMPLATE__DISPATCH__FREE(PerfMetricIntSeries)
 },
 {
@@ -6042,6 +6073,7 @@
 /* esxVI_ScsiLun_Free */
 ESX_VI__TEMPLATE__DYNAMIC_FREE(ScsiLun,
 {
+    /* ScsiLun */
     ESX_VI__TEMPLATE__DISPATCH__FREE(HostScsiDisk)
 },
 {
@@ -6320,6 +6352,7 @@
 /* esxVI_SelectionSpec_Free */
 ESX_VI__TEMPLATE__DYNAMIC_FREE(SelectionSpec,
 {
+    /* SelectionSpec */
     ESX_VI__TEMPLATE__DISPATCH__FREE(TraversalSpec)
 },
 {
@@ -6869,6 +6902,7 @@
 /* esxVI_VirtualDiskSpec_Free */
 ESX_VI__TEMPLATE__DYNAMIC_FREE(VirtualDiskSpec,
 {
+    /* VirtualDiskSpec */
     ESX_VI__TEMPLATE__DISPATCH__FREE(DeviceBackedVirtualDiskSpec)
     ESX_VI__TEMPLATE__DISPATCH__FREE(FileBackedVirtualDiskSpec)
 },
@@ -7156,6 +7190,7 @@
 /* esxVI_VmConfigFileInfo_Free */
 ESX_VI__TEMPLATE__DYNAMIC_FREE(VmConfigFileInfo,
 {
+    /* VmConfigFileInfo */
     ESX_VI__TEMPLATE__DISPATCH__FREE(TemplateConfigFileInfo)
 },
 {
@@ -7228,6 +7263,7 @@
 /* esxVI_VmConfigFileQuery_Free */
 ESX_VI__TEMPLATE__DYNAMIC_FREE(VmConfigFileQuery,
 {
+    /* VmConfigFileQuery */
     ESX_VI__TEMPLATE__DISPATCH__FREE(TemplateConfigFileQuery)
 },
 {
@@ -8140,6 +8176,7 @@
 /* esxVI_ManagedEntity_Free */
 ESX_VI__TEMPLATE__DYNAMIC_FREE(ManagedEntity,
 {
+    /* ManagedEntity */
     ESX_VI__TEMPLATE__DISPATCH__FREE(ComputeResource)
     ESX_VI__TEMPLATE__DISPATCH__FREE(Datacenter)
     ESX_VI__TEMPLATE__DISPATCH__FREE(Folder)


-- 
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

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]