Check for special "*" glob
authorenglebass <englebass@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 9 Feb 2011 21:20:42 +0000 (21:20 +0000)
committerenglebass <englebass@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 9 Feb 2011 21:20:42 +0000 (21:20 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/efreet@56878 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

ChangeLog
src/lib/efreet_utils.c

index 9062965..ac91f01 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -62,3 +62,4 @@
        * Don't free data returned by efreet_util_cache_names
        * Add free callback to eet hashes
        * Remove unneeded header
+       * Check if pattern equals "*" before doing pattern match
index ccd9df3..2c02276 100644 (file)
@@ -5,7 +5,6 @@
 /* TODO: move eet file handling to eet_cache.c */
 /* TODO: add no_display check, as we might want only displayable items */
 /* TODO: Consider flushing local cache after a idling a while */
-/* TODO: Add special check for glob "*" */
 
 #undef alloca
 #ifdef HAVE_ALLOCA_H
@@ -381,6 +380,8 @@ efreet_util_desktop_exec_glob_list(const char *glob)
 
     if (!efreet_cache_check(&cache, efreet_desktop_util_cache_file(), EFREET_DESKTOP_UTILS_CACHE_MAJOR)) return NULL;
     if (!glob) return NULL;
+    if (!strcmp(glob, "*"))
+        glob = NULL;
 
     names = efreet_util_cache_names(efreet_array_string_edd(), "exec_list");
     if (!names) return NULL;
@@ -393,7 +394,7 @@ efreet_util_desktop_exec_glob_list(const char *glob)
 
         exe = ecore_file_app_exe_get(names->array[i]);
         if (!exe) continue;
-        if (!efreet_util_glob_match(exe, glob))
+        if (glob && !efreet_util_glob_match(exe, glob))
         {
             free(exe);
             continue;
@@ -611,6 +612,8 @@ efreet_util_cache_glob_list(const char *search, const char *what)
 
     if (!efreet_cache_check(&cache, efreet_desktop_util_cache_file(), EFREET_DESKTOP_UTILS_CACHE_MAJOR)) return NULL;
     if (!what) return NULL;
+    if (!strcmp(what, "*"))
+        what = NULL;
 
     snprintf(key, sizeof(key), "%s_list", search);
     names = efreet_util_cache_names(efreet_array_string_edd(), key);
@@ -621,7 +624,7 @@ efreet_util_cache_glob_list(const char *search, const char *what)
         unsigned int j;
         Efreet_Desktop *desk;
 
-        if (!efreet_util_glob_match(names->array[i], what)) continue;
+        if (what && !efreet_util_glob_match(names->array[i], what)) continue;
 
         if (!hash)
         {