[libvirt] [libvirt-glib 1/5] Don't call g_type_init on newer glib

Zeeshan Ali (Khattak) zeeshanak at gnome.org
Tue Nov 13 17:53:48 UTC 2012


On Tue, Nov 13, 2012 at 6:30 PM, Christophe Fergeau <cfergeau at redhat.com> wrote:
> This function call is deprecated and calling it causes a compilation
> warning.
> ---
>  libvirt-gconfig/Makefile.am               |  1 +
>  libvirt-gconfig/libvirt-gconfig-compat.h  | 32 +++++++++++++++++++++++++++++++
>  libvirt-gconfig/libvirt-gconfig-main.c    |  1 +
>  libvirt-gconfig/tests/test-domain-parse.c |  2 --
>  libvirt-gobject/libvirt-gobject-main.c    |  1 +
>  5 files changed, 35 insertions(+), 2 deletions(-)
>  create mode 100644 libvirt-gconfig/libvirt-gconfig-compat.h
>
> diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
> index caa62f0..507e733 100644
> --- a/libvirt-gconfig/Makefile.am
> +++ b/libvirt-gconfig/Makefile.am
> @@ -76,6 +76,7 @@ GCONFIG_HEADER_FILES = \
>  noinst_HEADERS = \
>                         libvirt-gconfig-private.h \
>                         libvirt-gconfig-capabilities-cpu-private.h \
> +                       libvirt-gconfig-compat.h \
>                         libvirt-gconfig-domain-device-private.h \
>                         libvirt-gconfig-helpers-private.h \
>                         libvirt-gconfig-object-private.h \
> diff --git a/libvirt-gconfig/libvirt-gconfig-compat.h b/libvirt-gconfig/libvirt-gconfig-compat.h
> new file mode 100644
> index 0000000..85a420d
> --- /dev/null
> +++ b/libvirt-gconfig/libvirt-gconfig-compat.h
> @@ -0,0 +1,32 @@
> +/*
> + * libvirt-gconfig-compat.h: libvirt configuration
> + *
> + * Copyright (C) 2012 Red Hat, Inc.
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
> + *
> + * Author: Christophe Fergeau <cfergeau at redhat.com>
> + */
> +
> +#ifndef __LIBVIRT_GCONFIG_COMPAT_H__
> +#define __LIBVIRT_GCONFIG_COMPAT_H__
> +
> +#include <glib-object.h>
> +
> +#if GLIB_CHECK_VERSION(2, 34, 0)
> +#define g_type_init()
> +#endif
> +
> +#endif /* __LIBVIRT_GCONFIG_COMPAT_H__ */
> diff --git a/libvirt-gconfig/libvirt-gconfig-main.c b/libvirt-gconfig/libvirt-gconfig-main.c
> index 6fca85c..fa1963c 100644
> --- a/libvirt-gconfig/libvirt-gconfig-main.c
> +++ b/libvirt-gconfig/libvirt-gconfig-main.c
> @@ -28,6 +28,7 @@
>
>  #include "libvirt-glib/libvirt-glib.h"
>  #include "libvirt-gconfig/libvirt-gconfig.h"
> +#include "libvirt-gconfig/libvirt-gconfig-compat.h"
>
>  /**
>   * gvirt_config_init:
> diff --git a/libvirt-gconfig/tests/test-domain-parse.c b/libvirt-gconfig/tests/test-domain-parse.c
> index 11880de..33fc7be 100644
> --- a/libvirt-gconfig/tests/test-domain-parse.c
> +++ b/libvirt-gconfig/tests/test-domain-parse.c
> @@ -52,8 +52,6 @@ int main(int argc, char **argv)
>          return 2;
>      }
>
> -    g_type_init();
> -

With g_type_init defined for newer glib, we'll want to keep the
g_type_init() calls, no?

Looks good otherwise.


-- 
Regards,

Zeeshan Ali (Khattak)
FSF member#5124




More information about the libvir-list mailing list