Re: [PATCH libvirt-glib 3/5] Uncomment & fix code for returning config objects

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

 



Hi,

On Tue, Nov 22, 2011 at 12:39:30PM +0000, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> 
> ---
>  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@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: pgpEnbLT8bl3e.pgp
Description: PGP 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]