[Xfce4-commits] <garcon:master> Use g_strcmp0 everywhere in the code.

Nick Schermer nick at xfce.org
Sat Aug 29 21:40:01 CEST 2009


Updating branch refs/heads/master
         to 4f0fd727f1241c0b8c97186a60a97bc4d75c943f (commit)
       from ee318529ea9cb433c2ed12d23c6e23572610a5bc (commit)

commit 4f0fd727f1241c0b8c97186a60a97bc4d75c943f
Author: Nick Schermer <nick at xfce.org>
Date:   Sat Aug 29 21:39:13 2009 +0200

    Use g_strcmp0 everywhere in the code.

 garcon/garcon-menu-directory.c |    4 ++--
 garcon/garcon-menu-item.c      |   31 ++++++++++++++-----------------
 garcon/garcon-menu-node.c      |    6 +++---
 garcon/garcon-menu.c           |    6 +++---
 garcon/garcon-private.c        |   11 -----------
 garcon/garcon-private.h        |    3 ---
 6 files changed, 22 insertions(+), 39 deletions(-)

diff --git a/garcon/garcon-menu-directory.c b/garcon/garcon-menu-directory.c
index e55eff4..4b468a8 100644
--- a/garcon/garcon-menu-directory.c
+++ b/garcon/garcon-menu-directory.c
@@ -544,14 +544,14 @@ garcon_menu_directory_get_show_in_environment (GarconMenuDirectory *directory)
     {
       /* Check if your environemnt is in OnlyShowIn list */
       for (i = 0, show = FALSE; !show && directory->priv->only_show_in[i] != NULL; i++)
-        if (g_utf8_collate (directory->priv->only_show_in[i], env) == 0)
+        if (g_strcmp0 (directory->priv->only_show_in[i], env) == 0)
           show = TRUE;
     }
   else if (G_UNLIKELY (directory->priv->not_show_in != NULL))
     {
       /* Check if your environemnt is in NotShowIn list */
       for (i = 0, show = TRUE; show && directory->priv->not_show_in[i] != NULL; i++)
-        if (g_utf8_collate (directory->priv->not_show_in[i], env) == 0)
+        if (g_strcmp0 (directory->priv->not_show_in[i], env) == 0)
           show = FALSE;
     }
 
diff --git a/garcon/garcon-menu-item.c b/garcon/garcon-menu-item.c
index 6974b92..ec14ad8 100644
--- a/garcon/garcon-menu-item.c
+++ b/garcon/garcon-menu-item.c
@@ -967,7 +967,7 @@ garcon_menu_item_set_desktop_id (GarconMenuItem *item,
   g_return_if_fail (desktop_id != NULL);
 
   /* Abort if old and new desktop_id are equal */
-  if (_garcon_str_is_equal (item->priv->desktop_id, desktop_id))
+  if (g_strcmp0 (item->priv->desktop_id, desktop_id) == 0)
     return;
 
   /* Assign the new desktop_id */
@@ -1026,7 +1026,7 @@ garcon_menu_item_set_command (GarconMenuItem *item,
   g_return_if_fail (command != NULL);
 
   /* Abort if old and new command are equal */
-  if (_garcon_str_is_equal (item->priv->command, command))
+  if (g_strcmp0 (item->priv->command, command) == 0)
     return;
 
   /* Assign new command */
@@ -1055,7 +1055,7 @@ garcon_menu_item_set_try_exec (GarconMenuItem *item,
   g_return_if_fail (GARCON_IS_MENU_ITEM (item));
 
   /* Abort if old and new try_exec are equal */
-  if (_garcon_str_is_equal (item->priv->try_exec, try_exec))
+  if (g_strcmp0 (item->priv->try_exec, try_exec) == 0)
     return;
 
   /* Assign new try_exec */
@@ -1085,7 +1085,7 @@ garcon_menu_item_set_name (GarconMenuItem *item,
   g_return_if_fail (g_utf8_validate (name, -1, NULL));
 
   /* Abort if old and new name are equal */
-  if (_garcon_str_is_equal (item->priv->name, name))
+  if (g_strcmp0 (item->priv->name, name) == 0)
     return;
 
   /* Assign new name */
@@ -1115,7 +1115,7 @@ garcon_menu_item_set_generic_name (GarconMenuItem *item,
   g_return_if_fail (generic_name == NULL || g_utf8_validate (generic_name, -1, NULL));
 
   /* Abort if old and new generic name are equal */
-  if (_garcon_str_is_equal (item->priv->generic_name, generic_name))
+  if (g_strcmp0 (item->priv->generic_name, generic_name) == 0)
     return;
 
   /* Assign new generic_name */
@@ -1145,7 +1145,7 @@ garcon_menu_item_set_comment (GarconMenuItem *item,
   g_return_if_fail (comment == NULL || g_utf8_validate (comment, -1, NULL));
 
   /* Abort if old and new comment are equal */
-  if (_garcon_str_is_equal (item->priv->comment, comment))
+  if (g_strcmp0 (item->priv->comment, comment) == 0)
     return;
 
   /* Assign new comment */
@@ -1174,7 +1174,7 @@ garcon_menu_item_set_icon_name (GarconMenuItem *item,
   g_return_if_fail (GARCON_IS_MENU_ITEM (item));
 
   /* Abort if old and new icon name are equal */
-  if (_garcon_str_is_equal (item->priv->icon_name, icon_name))
+  if (g_strcmp0 (item->priv->icon_name, icon_name) == 0)
     return;
 
   /* Assign new icon name */
@@ -1203,7 +1203,7 @@ garcon_menu_item_set_path (GarconMenuItem *item,
   g_return_if_fail (GARCON_IS_MENU_ITEM (item));
 
   /* Abort if old and new path are equal */
-  if (_garcon_str_is_equal (item->priv->path, path))
+  if (g_strcmp0 (item->priv->path, path) == 0)
     return;
 
   /* Assign new path */
@@ -1338,12 +1338,9 @@ garcon_menu_item_has_category (GarconMenuItem *item,
   g_return_val_if_fail (GARCON_IS_MENU_ITEM (item), FALSE);
   g_return_val_if_fail (category != NULL, FALSE);
 
-  for (iter = item->priv->categories; iter != NULL; iter = g_list_next (iter))
-    if (G_UNLIKELY (g_utf8_collate (iter->data, category) == 0))
-      {
-        found = TRUE;
-        break;
-      }
+  for (iter = item->priv->categories; !found && iter != NULL; iter = g_list_next (iter))
+    if (g_strcmp0 (iter->data, category) == 0)
+      found = TRUE;
 
   return found;
 }
@@ -1372,14 +1369,14 @@ garcon_menu_item_get_show_in_environment (GarconMenuItem *item)
     {
       /* Check if your environemnt is in OnlyShowIn list */
       for (i = 0, show = FALSE; !show && item->priv->only_show_in[i] != NULL; i++)
-        if (g_utf8_collate (item->priv->only_show_in[i], env) == 0)
+        if (g_strcmp0 (item->priv->only_show_in[i], env) == 0)
           show = TRUE;
     }
   else if (G_UNLIKELY (item->priv->not_show_in != NULL))
     {
       /* Check if your environemnt is in NotShowIn list */
       for (i = 0, show = TRUE; show && item->priv->not_show_in[i] != NULL; i++)
-        if (g_utf8_collate (item->priv->not_show_in[i], env) == 0)
+        if (g_strcmp0 (item->priv->not_show_in[i], env) == 0)
           show = FALSE;
     }
 
@@ -1409,7 +1406,7 @@ garcon_menu_item_only_show_in_environment (GarconMenuItem *item)
     {
       /* Check if your environemnt is in OnlyShowIn list */
       for (i = 0, show = FALSE; !show && item->priv->only_show_in[i] != NULL; i++)
-        if (g_utf8_collate (item->priv->only_show_in[i], env) == 0)
+        if (g_strcmp0 (item->priv->only_show_in[i], env) == 0)
           show = TRUE;
     }
 
diff --git a/garcon/garcon-menu-node.c b/garcon/garcon-menu-node.c
index d0e02dc..cbbd7de 100644
--- a/garcon/garcon-menu-node.c
+++ b/garcon/garcon-menu-node.c
@@ -769,12 +769,12 @@ garcon_menu_node_tree_compare (GNode *tree,
     case GARCON_MENU_NODE_TYPE_NEW:
     case GARCON_MENU_NODE_TYPE_MENUNAME:
     case GARCON_MENU_NODE_TYPE_MERGE_DIR:
-      return g_utf8_collate (node->data.string, other_node->data.string);
+      return g_strcmp0 (node->data.string, other_node->data.string);
       break;
 
     case GARCON_MENU_NODE_TYPE_MERGE_FILE:
-      return g_utf8_collate (node->data.merge_file.filename,
-                             other_node->data.merge_file.filename);
+      return g_strcmp0 (node->data.merge_file.filename,
+                        other_node->data.merge_file.filename);
       break;
 
     default:
diff --git a/garcon/garcon-menu.c b/garcon/garcon-menu.c
index 5b1933c..edfb0f7 100644
--- a/garcon/garcon-menu.c
+++ b/garcon/garcon-menu.c
@@ -641,7 +641,7 @@ garcon_menu_get_menu_with_name (GarconMenu  *menu,
   for (iter = menu->priv->submenus; result == NULL && iter != NULL; iter = g_list_next (iter))
     {
       /* End loop when a matching submenu is found */
-      if (G_UNLIKELY (g_utf8_collate (garcon_menu_get_name (iter->data), name) == 0))
+      if (G_UNLIKELY (g_strcmp0 (garcon_menu_get_name (iter->data), name) == 0))
         result = iter->data;
     }
 
@@ -1367,8 +1367,8 @@ static gint
 garcon_menu_compare_items (gconstpointer *a,
                            gconstpointer *b)
 {
-  return g_utf8_collate (garcon_menu_element_get_name (GARCON_MENU_ELEMENT (a)),
-                         garcon_menu_element_get_name (GARCON_MENU_ELEMENT (b)));
+  return g_strcmp0 (garcon_menu_element_get_name (GARCON_MENU_ELEMENT (a)),
+                    garcon_menu_element_get_name (GARCON_MENU_ELEMENT (b)));
 }
 
 
diff --git a/garcon/garcon-private.c b/garcon/garcon-private.c
index 536f08e..a0ea039 100644
--- a/garcon/garcon-private.c
+++ b/garcon/garcon-private.c
@@ -106,14 +106,3 @@ _garcon_file_get_uri_relative_to_file (const gchar *path,
 
   return uri;
 }
-
-
-gboolean
-_garcon_str_is_equal (const gchar *a,
-                      const gchar *b)
-{
-  if (a == NULL || b == NULL)
-    return (a == b);
-
-  return (g_utf8_collate (a, b) == 0);
-}
diff --git a/garcon/garcon-private.h b/garcon/garcon-private.h
index f6e0850..3684be1 100644
--- a/garcon/garcon-private.h
+++ b/garcon/garcon-private.h
@@ -37,9 +37,6 @@ GFile    *_garcon_file_new_relative_to_file     (const gchar *path,
 gchar    *_garcon_file_get_uri_relative_to_file (const gchar *path,
                                                  GFile       *file);
 
-gboolean  _garcon_str_is_equal                  (const gchar *a,
-                                                 const gchar *b);
-
 G_END_DECLS
 
 #endif /* !__GARCON_PRIVATE_H__ */



More information about the Xfce4-commits mailing list