[glib] Use g_variant_is_of_type()



commit d3b091f63abde2f7de587986a65004ddf2c4ed2a
Author: Christian Persch <chpe gnome org>
Date:   Tue Jun 8 13:36:00 2010 +0200

    Use g_variant_is_of_type()
    
    ... instead of strcmp()'ing the type strings.
    
    Bug #620954.

 gio/gapplication.c     |    2 +-
 gio/gdbusapplication.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gio/gapplication.c b/gio/gapplication.c
index 854fad0..029bf29 100644
--- a/gio/gapplication.c
+++ b/gio/gapplication.c
@@ -407,7 +407,7 @@ g_application_register_with_data (GApplication  *application,
   g_return_if_fail (application->priv->appid != NULL);
   g_return_if_fail (application->priv->is_remote);
   g_return_if_fail (platform_data == NULL
-                    || strcmp (g_variant_get_type_string (platform_data), "a{sv}") == 0);
+                    || g_variant_is_of_type (platform_data, G_VARIANT_TYPE ("a{sv}")) == 0);
 
   if (!_g_application_platform_acquire_single_instance (application, NULL))
     {
diff --git a/gio/gdbusapplication.c b/gio/gdbusapplication.c
index 5b6088d..8b17ce4 100644
--- a/gio/gdbusapplication.c
+++ b/gio/gdbusapplication.c
@@ -332,7 +332,7 @@ _g_application_platform_acquire_single_instance (GApplication  *app,
   if (request_result == NULL)
     return FALSE;
 
-  if (strcmp (g_variant_get_type_string (request_result), "(u)") == 0)
+  if (g_variant_is_of_type (request_result, G_VARIANT_TYPE ("(u)")))
     g_variant_get (request_result, "(u)", &request_status);
   else
     request_status = 0;



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