[Xfce4-commits] <xfce4-xkb-plugin:master> Don't do ugly casts.

Jérôme Guelfucci noreply at xfce.org
Thu Apr 28 21:26:24 CEST 2011


Updating branch refs/heads/master
         to b0d598070fe9bda4a479657d2af1a12d1d51b755 (commit)
       from 97d75e2fce04ba780a166c4b4d5ab0697efd1e64 (commit)

commit b0d598070fe9bda4a479657d2af1a12d1d51b755
Author: Jérôme Guelfucci <jeromeg at xfce.org>
Date:   Thu Apr 28 20:25:17 2011 +0200

    Don't do ugly casts.

 panel-plugin/xkb-util.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/panel-plugin/xkb-util.c b/panel-plugin/xkb-util.c
index a096c29..360424e 100644
--- a/panel-plugin/xkb-util.c
+++ b/panel-plugin/xkb-util.c
@@ -62,6 +62,12 @@ xkb_util_get_layout_string (gchar *group_name, gchar *variant)
 gchar*
 xkb_util_normalize_group_name (gchar* group_name)
 {
+    gchar *c = group_name;
+    gchar *result;
+    gint cut_length;
+    gint index_of_na = -1;
+    gint index_tmp = -1;
+
     if (!group_name)
     {
         return NULL;
@@ -72,16 +78,13 @@ xkb_util_normalize_group_name (gchar* group_name)
         return g_strdup (group_name);
     }
 
-    gchar *c = group_name;
-    gchar *result;
-    gint cut_length;
-    gint index_of_na = -1;
-
     while (*c)
     {
+        index_tmp++;
+
         if (!((*c >= 'a' && *c <= 'z') || (*c >= 'A' && *c <= 'Z')))
         {
-            index_of_na = (int) c - (int) group_name;
+            index_of_na = index_tmp;
             break;
         }
 



More information about the Xfce4-commits mailing list