[libvirt] [PATCH libvirt-glib 3/5] Uncomment & fix code for returning config objects
Christophe Fergeau
cfergeau at redhat.com
Tue Nov 22 13:19:44 UTC 2011
Hi,
On Tue, Nov 22, 2011 at 12:39:30PM +0000, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
>
> ---
> libvirt-gobject/libvirt-gobject-domain-snapshot.c | 5 +----
> libvirt-gobject/libvirt-gobject-interface.c | 5 +----
> libvirt-gobject/libvirt-gobject-network-filter.c | 5 +----
> libvirt-gobject/libvirt-gobject-network.c | 5 +----
> libvirt-gobject/libvirt-gobject-node-device.c | 6 +-----
> libvirt-gobject/libvirt-gobject-secret.c | 6 +-----
> libvirt-gobject/libvirt-gobject-storage-pool.c | 5 +----
> libvirt-gobject/libvirt-gobject-storage-vol.c | 5 +----
> 8 files changed, 8 insertions(+), 34 deletions(-)
>
> diff --git a/libvirt-gobject/libvirt-gobject-domain-snapshot.c b/libvirt-gobject/libvirt-gobject-domain-snapshot.c
> index e536d72..c65a183 100644
> --- a/libvirt-gobject/libvirt-gobject-domain-snapshot.c
> +++ b/libvirt-gobject/libvirt-gobject-domain-snapshot.c
> @@ -210,11 +210,8 @@ GVirConfigDomainSnapshot *gvir_domain_snapshot_get_config
> return NULL;
> }
>
> -#if 0
> - GVirConfigDomainSnapshot *conf = gvir_config_domain_snapshot_new(xml);
> + GVirConfigDomainSnapshot *conf = gvir_config_domain_snapshot_new_from_xml(xml, err);
>
> g_free(xml);
> return conf;
The xml data comes from libvirt, so it should be freed with free(), not
g_free. The same comment applies to all the other hunks.
Christophe
> -#endif
> - return NULL;
> }
> diff --git a/libvirt-gobject/libvirt-gobject-interface.c b/libvirt-gobject/libvirt-gobject-interface.c
> index d35cdc2..e47395c 100644
> --- a/libvirt-gobject/libvirt-gobject-interface.c
> +++ b/libvirt-gobject/libvirt-gobject-interface.c
> @@ -199,11 +199,8 @@ GVirConfigInterface *gvir_interface_get_config(GVirInterface *iface,
> return NULL;
> }
>
> -#if 0
> - GVirConfigInterface *conf = gvir_config_interface_new(xml);
> + GVirConfigInterface *conf = gvir_config_interface_new_from_xml(xml, err);
>
> g_free(xml);
> return conf;
> -#endif
> - return NULL;
> }
> diff --git a/libvirt-gobject/libvirt-gobject-network-filter.c b/libvirt-gobject/libvirt-gobject-network-filter.c
> index 6ce0f7c..bdb0e3a 100644
> --- a/libvirt-gobject/libvirt-gobject-network-filter.c
> +++ b/libvirt-gobject/libvirt-gobject-network-filter.c
> @@ -225,11 +225,8 @@ GVirConfigNetworkFilter *gvir_network_filter_get_config
> return NULL;
> }
>
> -#if 0
> - GVirConfigNetworkFilter *conf = gvir_config_network_filter_new(xml);
> + GVirConfigNetworkFilter *conf = gvir_config_network_filter_new_from_xml(xml, err);
>
> g_free(xml);
> return conf;
> -#endif
> - return NULL;
> }
> diff --git a/libvirt-gobject/libvirt-gobject-network.c b/libvirt-gobject/libvirt-gobject-network.c
> index 237f788..c486561 100644
> --- a/libvirt-gobject/libvirt-gobject-network.c
> +++ b/libvirt-gobject/libvirt-gobject-network.c
> @@ -221,11 +221,8 @@ GVirConfigNetwork *gvir_network_get_config(GVirNetwork *network,
> return NULL;
> }
>
> -#if 0
> - GVirConfigNetwork *conf = gvir_config_network_new(xml);
> + GVirConfigNetwork *conf = gvir_config_network_new_from_xml(xml, err);
>
> g_free(xml);
> return conf;
> -#endif
> - return NULL;
> }
> diff --git a/libvirt-gobject/libvirt-gobject-node-device.c b/libvirt-gobject/libvirt-gobject-node-device.c
> index 162f930..43564b6 100644
> --- a/libvirt-gobject/libvirt-gobject-node-device.c
> +++ b/libvirt-gobject/libvirt-gobject-node-device.c
> @@ -200,12 +200,8 @@ GVirConfigNodeDevice *gvir_node_device_get_config(GVirNodeDevice *device,
> return NULL;
> }
>
> -#if 0
> - GVirConfigNodeDevice *conf = gvir_config_node_device_new(xml);
> + GVirConfigNodeDevice *conf = gvir_config_node_device_new_from_xml(xml, err);
>
> g_free(xml);
> return conf;
> -#endif
> -
> - return NULL;
> }
> diff --git a/libvirt-gobject/libvirt-gobject-secret.c b/libvirt-gobject/libvirt-gobject-secret.c
> index 5bde345..418e5aa 100644
> --- a/libvirt-gobject/libvirt-gobject-secret.c
> +++ b/libvirt-gobject/libvirt-gobject-secret.c
> @@ -211,12 +211,8 @@ GVirConfigSecret *gvir_secret_get_config(GVirSecret *secret,
> return NULL;
> }
>
> -#if 0
> - GVirConfigSecret *conf = gvir_config_secret_new(xml);
> + GVirConfigSecret *conf = gvir_config_secret_new_from_xml(xml, err);
>
> g_free(xml);
> return conf;
> -#endif
> -
> - return NULL;
> }
> diff --git a/libvirt-gobject/libvirt-gobject-storage-pool.c b/libvirt-gobject/libvirt-gobject-storage-pool.c
> index 915e0a1..92be539 100644
> --- a/libvirt-gobject/libvirt-gobject-storage-pool.c
> +++ b/libvirt-gobject/libvirt-gobject-storage-pool.c
> @@ -236,13 +236,10 @@ GVirConfigStoragePool *gvir_storage_pool_get_config(GVirStoragePool *pool,
> return NULL;
> }
>
> -#if 0
> - GVirConfigStoragePool *conf = gvir_config_storage_pool_new(xml);
> + GVirConfigStoragePool *conf = gvir_config_storage_pool_new_from_xml(xml, err);
>
> g_free(xml);
> return conf;
> -#endif
> - return NULL;
> }
>
> typedef gint (* CountFunction) (virStoragePoolPtr vpool);
> diff --git a/libvirt-gobject/libvirt-gobject-storage-vol.c b/libvirt-gobject/libvirt-gobject-storage-vol.c
> index a8aec60..17aac36 100644
> --- a/libvirt-gobject/libvirt-gobject-storage-vol.c
> +++ b/libvirt-gobject/libvirt-gobject-storage-vol.c
> @@ -211,11 +211,8 @@ GVirConfigStorageVol *gvir_storage_vol_get_config(GVirStorageVol *vol,
> return NULL;
> }
>
> -#if 0
> - GVirConfigStorageVol *conf = gvir_config_storage_vol_new(xml);
> + GVirConfigStorageVol *conf = gvir_config_storage_vol_new_from_xml(xml, err);
>
> g_free(xml);
> return conf;
> -#endif
> - return NULL;
> }
> --
> 1.7.6.4
>
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20111122/5d247e9c/attachment-0001.sig>
More information about the libvir-list
mailing list