Enlightenment CVS committal

Author  : onefang
Project : e17
Module  : apps/e_utils

Dir     : e17/apps/e_utils/src/bin/e17genmenu/src/bin


Modified Files:
        fdo_paths.c fdo_paths.h icons.c main.c 


Log Message:
Optimisation, don't recurse through sub directories when we don't need to.

===================================================================
RCS file: 
/cvsroot/enlightenment/e17/apps/e_utils/src/bin/e17genmenu/src/bin/fdo_paths.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- fdo_paths.c 3 Feb 2006 05:50:37 -0000       1.7
+++ fdo_paths.c 3 Feb 2006 06:52:16 -0000       1.8
@@ -103,11 +103,12 @@
  *
  * @param   type The type of directories to search.
  * @param   file The file to search for.
+ * @param   sub Should we search sub directories.
  * @param   func A function to call for each file found.
  * @param   data A pointer to pass on to func.
  */
 char *
-fdo_paths_search_for_file(Fdo_Paths_Type type, char *file,
+fdo_paths_search_for_file(Fdo_Paths_Type type, char *file, int sub,
                           int (*func) (const void *data, char *path),
                           const void *data)
 {
@@ -143,7 +144,7 @@
                 if (func(data, path))
                    break;
           }
-        else
+        else if (sub)
            path = _fdo_paths_recursive_search(paths->list[i], file, func, 
data);
         if (path && (!func))
            break;
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/apps/e_utils/src/bin/e17genmenu/src/bin/fdo_paths.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- fdo_paths.h 3 Feb 2006 05:50:38 -0000       1.3
+++ fdo_paths.h 3 Feb 2006 06:52:16 -0000       1.4
@@ -31,7 +31,7 @@
 # endif
 
    void fdo_paths_init();
-   char *fdo_paths_search_for_file(Fdo_Paths_Type type, char *file, int 
(*func) (const void *data, char *path), const void *data);
+   char *fdo_paths_search_for_file(Fdo_Paths_Type type, char *file, int sub, 
int (*func) (const void *data, char *path), const void *data);
    Fdo_Path_List *fdo_paths_paths_to_list(char *paths);
    void fdo_paths_shutdown();
 
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/apps/e_utils/src/bin/e17genmenu/src/bin/icons.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- icons.c     3 Feb 2006 06:12:25 -0000       1.6
+++ icons.c     3 Feb 2006 06:52:16 -0000       1.7
@@ -180,7 +180,7 @@
 #ifdef DEBUG
    printf("SEARCHING FOR %s\n", icn);
 #endif
-   theme_path = fdo_paths_search_for_file(FDO_PATHS_TYPE_ICON, icn, NULL, 
NULL);
+   theme_path = fdo_paths_search_for_file(FDO_PATHS_TYPE_ICON, icn, 1, NULL, 
NULL);
    if (theme_path)
       {
          Ecore_Hash *theme;
@@ -286,7 +286,7 @@
 #ifdef DEBUG
                                                          printf("FDO icon = 
%s\n", path);
 #endif
-                                                         found = 
fdo_paths_search_for_file(FDO_PATHS_TYPE_ICON, path, NULL, NULL);
+                                                         found = 
fdo_paths_search_for_file(FDO_PATHS_TYPE_ICON, path, 0, NULL, NULL);
                                                         if (found)
                                                            return found;
                                                         else
@@ -295,7 +295,7 @@
 #ifdef DEBUG
                                                                printf("FDO 
icon = %s\n", path);
 #endif
-                                                               found = 
fdo_paths_search_for_file(FDO_PATHS_TYPE_ICON, path, NULL, NULL);
+                                                               found = 
fdo_paths_search_for_file(FDO_PATHS_TYPE_ICON, path, 0, NULL, NULL);
                                                               if (found)
                                                                  return found;
                                                               else
@@ -304,7 +304,7 @@
 #ifdef DEBUG
                                                                      
printf("FDO icon = %s\n", path);
 #endif
-                                                                     found = 
fdo_paths_search_for_file(FDO_PATHS_TYPE_ICON, path, NULL, NULL);
+                                                                     found = 
fdo_paths_search_for_file(FDO_PATHS_TYPE_ICON, path, 0, NULL, NULL);
                                                                     if (found)
                                                                        return 
found;
                                                                     else
@@ -313,7 +313,7 @@
 #ifdef DEBUG
                                                                            
printf("FDO icon = %s\n", path);
 #endif
-                                                                           
found = fdo_paths_search_for_file(FDO_PATHS_TYPE_ICON, path, NULL, NULL);
+                                                                           
found = fdo_paths_search_for_file(FDO_PATHS_TYPE_ICON, path, 0, NULL, NULL);
                                                                           if 
(found)
                                                                              
return found;
                                                                        }
@@ -322,7 +322,11 @@
                                                      }
                                                }
                                          }
-                                   }
+                                   }   /* for (i = 0; i < 
directory_paths->size; i++) */
+
+                                 /* Fall back strategy #1, look for closest 
size in this theme. */
+                                 /* Fall back strategy #2, Just search in the 
base of the icon directories. */
+
                              }
                        }
                  }
===================================================================
RCS file: 
/cvsroot/enlightenment/e17/apps/e_utils/src/bin/e17genmenu/src/bin/main.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- main.c      3 Feb 2006 05:50:38 -0000       1.8
+++ main.c      3 Feb 2006 06:52:16 -0000       1.9
@@ -45,7 +45,7 @@
      printf("FDO icon path = %s\n", fdo_paths_icons->list[i]);
 
    /* First, find the main menu file. */
-   path = fdo_paths_search_for_file(FDO_PATHS_TYPE_MENU, menu, NULL, NULL);
+   path = fdo_paths_search_for_file(FDO_PATHS_TYPE_MENU, menu, 1, NULL, NULL);
    if (path)
       {
          char *directory = "Applications.directory";
@@ -58,14 +58,14 @@
          /* During the processing of the menu file, you will need to search 
for 
          * .directory files, .desktop files, and icons.
          */
-         path = fdo_paths_search_for_file(FDO_PATHS_TYPE_DIRECTORY, directory, 
NULL, NULL);
+         path = fdo_paths_search_for_file(FDO_PATHS_TYPE_DIRECTORY, directory, 
1, NULL, NULL);
          if (path)
            {
                printf("Path to %s is %s\n", directory, path);
               free(path);
            }
 
-         path = fdo_paths_search_for_file(FDO_PATHS_TYPE_DESKTOP, desktop, 
NULL, NULL);
+         path = fdo_paths_search_for_file(FDO_PATHS_TYPE_DESKTOP, desktop, 1, 
NULL, NULL);
          if (path)
            {
               Ecore_Hash *desktop_hash;
@@ -78,7 +78,7 @@
               free(path);
            }
 
-         path = fdo_paths_search_for_file(FDO_PATHS_TYPE_ICON, icon, NULL, 
NULL);
+         path = fdo_paths_search_for_file(FDO_PATHS_TYPE_ICON, icon, 1, NULL, 
NULL);
          if (path)
            {
                printf("Path to %s is %s\n", icon, path);




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to