[virt-tools-list] [PATCH virt-viewer] util: fix glib_check_version() condition
Christophe Fergeau
cfergeau at redhat.com
Wed Jun 11 15:49:08 UTC 2014
On Wed, Jun 11, 2014 at 05:21:59PM +0200, Marc-André Lureau wrote:
> glib_check_version() returns NULL if version is higher or equal.
> ---
> src/virt-viewer-util.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/virt-viewer-util.c b/src/virt-viewer-util.c
> index c81c09a..6fdaa07 100644
> --- a/src/virt-viewer-util.c
> +++ b/src/virt-viewer-util.c
> @@ -283,7 +283,7 @@ static void log_handler(const gchar *log_domain,
> const gchar *message,
> gpointer unused_data)
> {
> - if (!glib_check_version(2, 32, 0))
> + if (glib_check_version(2, 32, 0) != NULL)
> if (log_level >= G_LOG_LEVEL_DEBUG && !doDebug)
> return;
Or maybe this?
diff --git a/src/virt-viewer-util.c b/src/virt-viewer-util.c
index c81c09a..06cbdfa 100644
--- a/src/virt-viewer-util.c
+++ b/src/virt-viewer-util.c
@@ -278,17 +278,18 @@ gulong virt_viewer_signal_connect_object(gpointer
instance
return ctx->handler_id;
}
+#if !GLIB_CHECK_VERSION(2, 32, 0)
static void log_handler(const gchar *log_domain,
GLogLevelFlags log_level,
const gchar *message,
gpointer unused_data)
{
- if (!glib_check_version(2, 32, 0))
- if (log_level >= G_LOG_LEVEL_DEBUG && !doDebug)
- return;
+ if (log_level >= G_LOG_LEVEL_DEBUG && !doDebug)
+ return;
g_log_default_handler(log_domain, log_level, message, unused_data);
}
+#endif
void virt_viewer_util_init(const char *appname)
{
@@ -323,7 +324,9 @@ void virt_viewer_util_init(const char *appname)
g_set_application_name(appname);
+#if !GLIB_CHECK_VERSION(2, 32, 0)
g_log_set_default_handler(log_handler, NULL);
+#endif
}
static gchar *
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20140611/317da832/attachment.sig>
More information about the virt-tools-list
mailing list