[libvirt] [gconfig v2 3/6] Introduce libvirt-gconfig-domain-graphics-listen-address
Christophe Fergeau
cfergeau at redhat.com
Fri Sep 2 14:16:23 UTC 2016
On Wed, Aug 17, 2016 at 06:58:48PM +0300, Visarion Alexandru wrote:
> From: Visarion Alexandru <viorel.visarion at gmail.com>
>
> This is needed to be able to change the address a graphics
> device is listening for.
> ---
> libvirt-gconfig/Makefile.am | 2 +
> ...ibvirt-gconfig-domain-graphics-listen-address.c | 128 +++++++++++++++++++++
> ...ibvirt-gconfig-domain-graphics-listen-address.h | 78 +++++++++++++
> libvirt-gconfig/libvirt-gconfig.h | 1 +
> libvirt-gconfig/libvirt-gconfig.sym | 7 ++
> 5 files changed, 216 insertions(+)
> create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.c
> create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.h
>
> diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
> index 09739c5..5e66c4a 100644
> --- a/libvirt-gconfig/Makefile.am
> +++ b/libvirt-gconfig/Makefile.am
> @@ -47,6 +47,7 @@ GCONFIG_HEADER_FILES = \
> libvirt-gconfig-domain-graphics.h \
> libvirt-gconfig-domain-graphics-desktop.h \
> libvirt-gconfig-domain-graphics-listen.h\
> + libvirt-gconfig-domain-graphics-listen-address.h\
> libvirt-gconfig-domain-graphics-rdp.h \
> libvirt-gconfig-domain-graphics-sdl.h \
> libvirt-gconfig-domain-graphics-spice.h \
> @@ -141,6 +142,7 @@ GCONFIG_SOURCE_FILES = \
> libvirt-gconfig-domain-graphics.c \
> libvirt-gconfig-domain-graphics-desktop.c \
> libvirt-gconfig-domain-graphics-listen.c\
> + libvirt-gconfig-domain-graphics-listen-address.c\
> libvirt-gconfig-domain-graphics-rdp.c \
> libvirt-gconfig-domain-graphics-sdl.c \
> libvirt-gconfig-domain-graphics-spice.c \
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.c b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.c
> new file mode 100644
> index 0000000..74815a8
> --- /dev/null
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.c
> +
> +void gvir_config_domain_graphics_listen_address_set_address(GVirConfigDomainGraphicsListenAddress *listen,
> + const gchar *address)
> +{
> + g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_LISTEN_ADDRESS(listen));
> +
> + gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(listen),
> + "address", address,
> + NULL);
> +}
> +
> +const gchar *
> +gvir_config_domain_graphics_listen_address_get_address(GVirConfigDomainGraphicsListenAddress *listen)
> +{
> + g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_LISTEN_ADDRESS(listen), NULL);
> +
> + return gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(listen),
> + NULL,
> + "address");
> +}
> +
> +void gvir_config_domain_graphics_listen_address_set_inet_address(GVirConfigDomainGraphicsListenAddress *listen,
> + GInetAddress *address)
> +{
> + g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_LISTEN_ADDRESS(listen));
> +
> + gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(listen),
> + "address", g_inet_address_to_string (address),
> + NULL);
You need to g_free() the string returned by
g_inet_address_new_from_string() after using it or you will have a
memory leak. Fixed locally too, so no need to resend.
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160902/c044ed71/attachment-0001.sig>
More information about the libvir-list
mailing list