summaryrefslogtreecommitdiff
path: root/legacy/ecore/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--legacy/ecore/src/lib/ecore_file/ecore_file.c81
-rw-r--r--legacy/ecore/src/lib/ecore_file/ecore_file_private.h11
2 files changed, 0 insertions, 92 deletions
diff --git a/legacy/ecore/src/lib/ecore_file/ecore_file.c b/legacy/ecore/src/lib/ecore_file/ecore_file.c
index fd4faa9..065f8ba 100644
--- a/legacy/ecore/src/lib/ecore_file/ecore_file.c
+++ b/legacy/ecore/src/lib/ecore_file/ecore_file.c
@@ -29,47 +29,6 @@
29int _ecore_file_log_dom = -1; 29int _ecore_file_log_dom = -1;
30static int _ecore_file_init_count = 0; 30static int _ecore_file_init_count = 0;
31 31
32static Eina_Bool
33_ecore_file_ls_iterator_next(Ecore_File_Iterator *it, void **data)
34{
35 struct dirent *dp;
36 char *name;
37 size_t length;
38
39 do
40 {
41 dp = readdir(it->dirp);
42 if (!dp) return EINA_FALSE;
43 }
44 while (!strcmp(dp->d_name, ".")
45 || !strcmp(dp->d_name, ".."));
46
47 length = strlen(dp->d_name);
48 name = alloca(length + 2 + it->length);
49
50 memcpy(name, it->dir, it->length);
51 memcpy(name + it->length, "/", 1);
52 memcpy(name + it->length + 1, dp->d_name, length + 1);
53
54 *data = (char*) eina_stringshare_add(name);
55 return EINA_TRUE;
56}
57
58static char *
59_ecore_file_ls_iterator_container(Ecore_File_Iterator *it)
60{
61 return it->dir;
62}
63
64static void
65_ecore_file_ls_iterator_free(Ecore_File_Iterator *it)
66{
67 closedir(it->dirp);
68
69 EINA_MAGIC_SET(&it->iterator, 0);
70 free(it);
71}
72
73/* externally accessible functions */ 32/* externally accessible functions */
74/** 33/**
75 * Initialize Ecore_File and the services it will use. Call this function 34 * Initialize Ecore_File and the services it will use. Call this function
@@ -741,46 +700,6 @@ ecore_file_ls(const char *dir)
741} 700}
742 701
743/** 702/**
744 * Get an iterator to list the content of a directory. Give a chance to interrupt it
745 * and make it completly asynchrone.
746 * The iterator will walk over '.' and '..' without returning them.
747 * @param dir The name of the directory to list
748 * @return Return an Eina_Iterator that will walk over the files and directory in the pointed
749 * directory. On failure it will return NULL.
750 */
751EAPI Eina_Iterator *
752ecore_file_ls_iterator(const char *dir)
753{
754 Ecore_File_Iterator *it;
755 size_t length;
756
757 if (!dir) return NULL;
758
759 length = strlen(dir);
760
761 it = malloc(sizeof (Ecore_File_Iterator) + length);
762 if (!it) return NULL;
763
764 EINA_MAGIC_SET(&it->iterator, EINA_MAGIC_ITERATOR);
765
766 it->dirp = opendir(dir);
767 if (!it->dirp)
768 {
769 free(it);
770 return NULL;
771 }
772
773 memcpy(it->dir, dir, length + 1);
774 it->length = length;
775
776 it->iterator.next = FUNC_ITERATOR_NEXT(_ecore_file_ls_iterator_next);
777 it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(_ecore_file_ls_iterator_container);
778 it->iterator.free = FUNC_ITERATOR_FREE(_ecore_file_ls_iterator_free);
779
780 return &it->iterator;
781}
782
783/**
784 * FIXME: To be documented. 703 * FIXME: To be documented.
785 */ 704 */
786EAPI char * 705EAPI char *
diff --git a/legacy/ecore/src/lib/ecore_file/ecore_file_private.h b/legacy/ecore/src/lib/ecore_file/ecore_file_private.h
index 95cc1c7..11606df 100644
--- a/legacy/ecore/src/lib/ecore_file/ecore_file_private.h
+++ b/legacy/ecore/src/lib/ecore_file/ecore_file_private.h
@@ -82,17 +82,6 @@ struct _Ecore_File_Monitor
82 Ecore_File *files; 82 Ecore_File *files;
83}; 83};
84 84
85typedef struct _Ecore_File_Iterator Ecore_File_Iterator;
86struct _Ecore_File_Iterator
87{
88 Eina_Iterator iterator;
89
90 DIR *dirp;
91 int length;
92
93 char dir[1];
94};
95
96#ifdef HAVE_INOTIFY 85#ifdef HAVE_INOTIFY
97int ecore_file_monitor_inotify_init(void); 86int ecore_file_monitor_inotify_init(void);
98int ecore_file_monitor_inotify_shutdown(void); 87int ecore_file_monitor_inotify_shutdown(void);