Enlightenment CVS committal

Author  : dj2
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_widget.c 


Log Message:
- speed up ewl_widget_type_is. This makes things ~10% faster when in DEBUG
  and there are a lot of widgets (opening a directory with 10000 files) 

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_widget.c,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -3 -r1.91 -r1.92
--- ewl_widget.c        24 Jul 2006 23:51:54 -0000      1.91
+++ ewl_widget.c        1 Aug 2006 21:32:16 -0000       1.92
@@ -295,19 +295,19 @@
  */
 void ewl_widget_obscure(Ewl_Widget *w)
 {
-        DENTER_FUNCTION(DLEVEL_STABLE);
-        DCHECK_PARAM_PTR("w", w);
+       DENTER_FUNCTION(DLEVEL_STABLE);
+       DCHECK_PARAM_PTR("w", w);
 
        if (OBSCURED(w))
                DRETURN(DLEVEL_STABLE);
 
-        ewl_object_visible_add(EWL_OBJECT(w), EWL_FLAG_VISIBLE_OBSCURED);
+       ewl_object_visible_add(EWL_OBJECT(w), EWL_FLAG_VISIBLE_OBSCURED);
 
-        if (REALIZED(w) || ewl_object_queued_has(EWL_OBJECT(w),
-                                EWL_FLAG_QUEUED_RSCHEDULED))
-                ewl_callback_call(w, EWL_CALLBACK_OBSCURE);
+       if (REALIZED(w) || ewl_object_queued_has(EWL_OBJECT(w),
+                               EWL_FLAG_QUEUED_RSCHEDULED))
+               ewl_callback_call(w, EWL_CALLBACK_OBSCURE);
 
-        DLEAVE_FUNCTION(DLEVEL_STABLE);
+       DLEAVE_FUNCTION(DLEVEL_STABLE);
 }
 
 /**
@@ -1579,7 +1579,6 @@
 ewl_widget_type_is(Ewl_Widget *widget, const char *type)
 {
        int found = FALSE;
-       int end;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR_RET("widget", widget, FALSE);
@@ -1587,14 +1586,35 @@
        /* we don't check the type of the widget in here or we'll get into
         * an infinate loop ... */
 
-       end = strlen(type);
-       if (widget->inheritance) {
-               char *match;
+       if (widget->inheritance) 
+       {
+               char *match, *end;
+
                match = (char *)widget->inheritance;
-               while ((match = strstr(match, type))) {
-                       if ((*(match - 1) == ':') && (*(match + end) == ':'))
+               end = match + 1;
+
+               while (*end != '\0')
+               {
+                       int count = 0;
+
+                       /* while the type still matches the current part of
+                        * the string */
+                       while ((*(type + count) == *end) && (*end != ':'))
+                       {
+                               count ++;
+                               end ++;
+                       }
+
+                       /* if we ended with the : then this is a match */
+                       if (*end == ':')
+                       {
                                found = TRUE;
-                       match++;
+                               break;
+                       }
+
+                       /* move to the next set of :s and then move past it */
+                       while ((*end != '\0') && (*end != ':')) end ++;
+                       while (*end == ':') end ++;
                }
        }
 
@@ -2178,7 +2198,7 @@
  */
 void
 ewl_widget_reveal_cb(Ewl_Widget *w, void *ev_data __UNUSED__,
-                                          void *user_data __UNUSED__)
+                                         void *user_data __UNUSED__)
 {
        Ewl_Embed *emb;
 
@@ -2219,7 +2239,7 @@
                /*
                 * Attempt to load a cached object first, fallback to adding a
                 * new one.
-                 */
+                */
                w->theme_object = ewl_embed_object_request(emb, "edje");
                if (!w->theme_object) {
                        w->theme_object = edje_object_add(emb->evas);
@@ -2342,7 +2362,7 @@
  */
 void
 ewl_widget_obscure_cb(Ewl_Widget *w, void *ev_data __UNUSED__,
-                                           void *user_data __UNUSED__)
+                                          void *user_data __UNUSED__)
 {
        Ewl_Embed *emb;
        Ewl_Container *pc;



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to