summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dransfeld <sd@tango.flipp.net>2012-10-18 09:12:25 +0000
committerSebastian Dransfeld <sd@tango.flipp.net>2012-10-18 09:12:25 +0000
commit4eb8b955a9f35c65749028275b40f0da870d4098 (patch)
tree2c8289f112b756478572ee05f4832574407f1090
parentb6add7a5183d8d73efc1dad7bc7c3bf800cdd88c (diff)
efreet: optimize stat
use eina_file_stat_ls instead of eina_file.*_ls + ecore_file_is_dir SVN revision: 78173
-rw-r--r--legacy/efreet/src/bin/efreet_desktop_cache_create.c4
-rw-r--r--legacy/efreet/src/lib/efreet_desktop.c5
-rw-r--r--legacy/efreet/src/lib/efreet_icon.c12
-rw-r--r--legacy/efreet/src/lib/efreet_menu.c12
-rw-r--r--legacy/efreet/src/lib/efreet_utils.c8
5 files changed, 22 insertions, 19 deletions
diff --git a/legacy/efreet/src/bin/efreet_desktop_cache_create.c b/legacy/efreet/src/bin/efreet_desktop_cache_create.c
index c3970224e5..af60a84fc6 100644
--- a/legacy/efreet/src/bin/efreet_desktop_cache_create.c
+++ b/legacy/efreet/src/bin/efreet_desktop_cache_create.c
@@ -140,7 +140,7 @@ cache_scan(const char *path, const char *base_id, int priority, int recurse, int
140 140
141 if (!ecore_file_is_dir(path)) return 1; 141 if (!ecore_file_is_dir(path)) return 1;
142 142
143 it = eina_file_direct_ls(path); 143 it = eina_file_stat_ls(path);
144 if (!it) return 1; 144 if (!it) return 1;
145 145
146 id[0] = '\0'; 146 id[0] = '\0';
@@ -159,7 +159,7 @@ cache_scan(const char *path, const char *base_id, int priority, int recurse, int
159 } 159 }
160 160
161 snprintf(buf, sizeof(buf), "%s/%s", path, fname); 161 snprintf(buf, sizeof(buf), "%s/%s", path, fname);
162 if (ecore_file_is_dir(buf)) 162 if (info->type == EINA_FILE_DIR)
163 { 163 {
164 if (recurse) 164 if (recurse)
165 cache_scan(buf, file_id, priority, recurse, changed); 165 cache_scan(buf, file_id, priority, recurse, changed);
diff --git a/legacy/efreet/src/lib/efreet_desktop.c b/legacy/efreet/src/lib/efreet_desktop.c
index 348aee3e75..363f497c71 100644
--- a/legacy/efreet/src/lib/efreet_desktop.c
+++ b/legacy/efreet/src/lib/efreet_desktop.c
@@ -1033,11 +1033,12 @@ efreet_desktop_changes_listen_recursive(const char *path)
1033 1033
1034 efreet_desktop_changes_monitor_add(path); 1034 efreet_desktop_changes_monitor_add(path);
1035 1035
1036 it = eina_file_direct_ls(path); 1036 it = eina_file_stat_ls(path);
1037 if (!it) return; 1037 if (!it) return;
1038 EINA_ITERATOR_FOREACH(it, info) 1038 EINA_ITERATOR_FOREACH(it, info)
1039 { 1039 {
1040 if (ecore_file_is_dir(info->path)) efreet_desktop_changes_listen_recursive(info->path); 1040 if (info->type != EINA_FILE_DIR) continue;
1041 efreet_desktop_changes_listen_recursive(info->path);
1041 } 1042 }
1042 eina_iterator_free(it); 1043 eina_iterator_free(it);
1043} 1044}
diff --git a/legacy/efreet/src/lib/efreet_icon.c b/legacy/efreet/src/lib/efreet_icon.c
index 1bcada54e6..de8dfd96bd 100644
--- a/legacy/efreet/src/lib/efreet_icon.c
+++ b/legacy/efreet/src/lib/efreet_icon.c
@@ -852,7 +852,7 @@ static void
852efreet_icon_changes_monitor_add(const char *path) 852efreet_icon_changes_monitor_add(const char *path)
853{ 853{
854 Eina_Iterator *it; 854 Eina_Iterator *it;
855 const char *ent; 855 Eina_File_Direct_Info *info;
856 856
857 if (!ecore_file_is_dir(path)) return; 857 if (!ecore_file_is_dir(path)) return;
858 if (eina_hash_find(change_monitors, path)) return; 858 if (eina_hash_find(change_monitors, path)) return;
@@ -861,13 +861,13 @@ efreet_icon_changes_monitor_add(const char *path)
861 efreet_icon_changes_cb, 861 efreet_icon_changes_cb,
862 NULL)); 862 NULL));
863 863
864 it = eina_file_ls(path); 864 it = eina_file_stat_ls(path);
865 if (!it) return; 865 if (!it) return;
866 EINA_ITERATOR_FOREACH(it, ent) 866 EINA_ITERATOR_FOREACH(it, info)
867 { 867 {
868 if (!ecore_file_is_dir(ent)) continue; 868 if (info->type != EINA_FILE_DIR) continue;
869 eina_hash_add(change_monitors, ent, 869 eina_hash_add(change_monitors, info->path,
870 ecore_file_monitor_add(ent, 870 ecore_file_monitor_add(info->path,
871 efreet_icon_changes_cb, 871 efreet_icon_changes_cb,
872 NULL)); 872 NULL));
873 } 873 }
diff --git a/legacy/efreet/src/lib/efreet_menu.c b/legacy/efreet/src/lib/efreet_menu.c
index 19d1c4794e..8cefea8ab9 100644
--- a/legacy/efreet/src/lib/efreet_menu.c
+++ b/legacy/efreet/src/lib/efreet_menu.c
@@ -1808,7 +1808,7 @@ efreet_menu_handle_legacy_dir_helper(Efreet_Menu_Internal *root,
1808 efreet_menu_create_filter_list(legacy_internal); 1808 efreet_menu_create_filter_list(legacy_internal);
1809 legacy_internal->filters = eina_list_append(legacy_internal->filters, filter); 1809 legacy_internal->filters = eina_list_append(legacy_internal->filters, filter);
1810 1810
1811 it = eina_file_direct_ls(path); 1811 it = eina_file_stat_ls(path);
1812 if (it) 1812 if (it)
1813 { 1813 {
1814 Eina_File_Direct_Info *info; 1814 Eina_File_Direct_Info *info;
@@ -1822,7 +1822,7 @@ efreet_menu_handle_legacy_dir_helper(Efreet_Menu_Internal *root,
1822 1822
1823 fname = info->path + info->name_start; 1823 fname = info->path + info->name_start;
1824 /* recurse into sub directories */ 1824 /* recurse into sub directories */
1825 if (ecore_file_is_dir(info->path)) 1825 if (info->type == EINA_FILE_DIR)
1826 { 1826 {
1827 Efreet_Menu_Internal *ret; 1827 Efreet_Menu_Internal *ret;
1828 1828
@@ -3295,7 +3295,7 @@ efreet_menu_app_dir_scan(Efreet_Menu_Internal *internal, const char *path, const
3295 Eina_Iterator *it; 3295 Eina_Iterator *it;
3296 Eina_File_Direct_Info *info; 3296 Eina_File_Direct_Info *info;
3297 3297
3298 it = eina_file_direct_ls(path); 3298 it = eina_file_stat_ls(path);
3299 if (!it) return 1; 3299 if (!it) return 1;
3300 3300
3301 EINA_ITERATOR_FOREACH(it, info) 3301 EINA_ITERATOR_FOREACH(it, info)
@@ -3308,7 +3308,7 @@ efreet_menu_app_dir_scan(Efreet_Menu_Internal *internal, const char *path, const
3308 else 3308 else
3309 strcpy(buf2, fname); 3309 strcpy(buf2, fname);
3310 3310
3311 if (ecore_file_is_dir(info->path)) 3311 if (info->type == EINA_FILE_DIR)
3312 { 3312 {
3313 if (!legacy) 3313 if (!legacy)
3314 efreet_menu_app_dir_scan(internal, info->path, buf2, legacy); 3314 efreet_menu_app_dir_scan(internal, info->path, buf2, legacy);
@@ -3403,7 +3403,7 @@ efreet_menu_directory_dir_scan(const char *path, const char *relative_path,
3403 Eina_File_Direct_Info *info; 3403 Eina_File_Direct_Info *info;
3404 char *ext; 3404 char *ext;
3405 3405
3406 it = eina_file_direct_ls(path); 3406 it = eina_file_stat_ls(path);
3407 if (!it) return 1; 3407 if (!it) return 1;
3408 3408
3409 EINA_ITERATOR_FOREACH(it, info) 3409 EINA_ITERATOR_FOREACH(it, info)
@@ -3416,7 +3416,7 @@ efreet_menu_directory_dir_scan(const char *path, const char *relative_path,
3416 else 3416 else
3417 strcpy(buf2, fname); 3417 strcpy(buf2, fname);
3418 3418
3419 if (ecore_file_is_dir(info->path)) 3419 if (info->type == EINA_FILE_DIR)
3420 efreet_menu_directory_dir_scan(info->path, buf2, cache); 3420 efreet_menu_directory_dir_scan(info->path, buf2, cache);
3421 3421
3422 else 3422 else
diff --git a/legacy/efreet/src/lib/efreet_utils.c b/legacy/efreet/src/lib/efreet_utils.c
index dab85ef390..2b732e9001 100644
--- a/legacy/efreet/src/lib/efreet_utils.c
+++ b/legacy/efreet/src/lib/efreet_utils.c
@@ -358,16 +358,18 @@ efreet_util_menus_find_helper(Eina_List *menus, const char *config_dir)
358 char dbuf[PATH_MAX]; 358 char dbuf[PATH_MAX];
359 359
360 snprintf(dbuf, sizeof(dbuf), "%s/menus", config_dir); 360 snprintf(dbuf, sizeof(dbuf), "%s/menus", config_dir);
361 it = eina_file_direct_ls(dbuf); 361 it = eina_file_stat_ls(dbuf);
362 if (!it) return menus; 362 if (!it) return menus;
363 EINA_ITERATOR_FOREACH(it, info) 363 EINA_ITERATOR_FOREACH(it, info)
364 { 364 {
365 const char *exten; 365 const char *exten;
366
367 if (info->type == EINA_FILE_DIR) continue;
368
366 exten = strrchr(info->path + info->name_start, '.'); 369 exten = strrchr(info->path + info->name_start, '.');
367 if (!exten) continue; 370 if (!exten) continue;
368 if (strcmp(".menu", exten)) continue;
369 371
370 if (ecore_file_is_dir(info->path)) continue; 372 if (strcmp(".menu", exten)) continue;
371 373
372 menus = eina_list_append(menus, strdup(info->path)); 374 menus = eina_list_append(menus, strdup(info->path));
373 } 375 }