[Xfce4-commits] <xfconf:master> Optimize _xfconf_gtype_from_string().

Nick Schermer noreply at xfce.org
Tue Feb 2 17:48:01 CET 2010


Updating branch refs/heads/master
         to 262bf1158d9929d4ccd61699503ae5cf0daf239d (commit)
       from 907e602e70aaf0f60881ee244896d5751a8de82f (commit)

commit 262bf1158d9929d4ccd61699503ae5cf0daf239d
Author: Nick Schermer <nick at xfce.org>
Date:   Tue Feb 2 17:06:10 2010 +0100

    Optimize _xfconf_gtype_from_string().
    
    Sort the list and move the most frequent used types
    in my xfconf config dir to the top.

 common/xfconf-gvaluefuncs.c |   29 +++++++++++++++--------------
 1 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/common/xfconf-gvaluefuncs.c b/common/xfconf-gvaluefuncs.c
index e8a3d92..77153c9 100644
--- a/common/xfconf-gvaluefuncs.c
+++ b/common/xfconf-gvaluefuncs.c
@@ -66,8 +66,21 @@
 GType
 _xfconf_gtype_from_string(const gchar *type)
 {
-    if(!strcmp(type, "string"))
+    /* note: move the most frequently used types to the top */
+    if(!strcmp(type, "empty"))
+        return G_TYPE_NONE;
+    else if(!strcmp(type, "string"))
         return G_TYPE_STRING;
+    else if(!strcmp(type, "int"))
+        return G_TYPE_INT;
+    else if(!strcmp(type, "double"))
+        return G_TYPE_DOUBLE;
+    else if(!strcmp(type, "bool"))
+        return G_TYPE_BOOLEAN;
+    else if(!strcmp(type, "array"))
+        return XFCONF_TYPE_G_VALUE_ARRAY;
+    else if(!strcmp(type, "uint"))
+        return G_TYPE_UINT;
     else if(!strcmp(type, "uchar"))
         return G_TYPE_UCHAR;
     else if(!strcmp(type, "char"))
@@ -76,25 +89,13 @@ _xfconf_gtype_from_string(const gchar *type)
         return XFCONF_TYPE_UINT16;
     else if(!strcmp(type, "int16"))
         return XFCONF_TYPE_INT16;
-    else if(!strcmp(type, "uint"))
-        return G_TYPE_UINT;
-    else if(!strcmp(type, "int"))
-        return G_TYPE_INT;
     else if(!strcmp(type, "uint64"))
         return G_TYPE_UINT64;
     else if(!strcmp(type, "int64"))
         return G_TYPE_INT64;
     else if(!strcmp(type, "float"))
         return G_TYPE_FLOAT;
-    else if(!strcmp(type, "double"))
-        return G_TYPE_DOUBLE;
-    else if(!strcmp(type, "bool"))
-        return G_TYPE_BOOLEAN;
-    else if(!strcmp(type, "array"))
-        return XFCONF_TYPE_G_VALUE_ARRAY;
-    else if(!strcmp(type, "empty"))
-        return G_TYPE_NONE;
-    
+
     return G_TYPE_INVALID;
 }
 



More information about the Xfce4-commits mailing list