summaryrefslogtreecommitdiff
path: root/legacy/ecore/src/lib/ecore_file/ecore_file.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2010-07-02 17:23:05 +0000
committerCedric BAIL <cedric.bail@free.fr>2010-07-02 17:23:05 +0000
commitd4059c7107407493e25fe1e46e3a96410893dc9a (patch)
tree6e6ed6ab5d9bc05f61bcd6f3de433dea09836d25 /legacy/ecore/src/lib/ecore_file/ecore_file.c
parent9560d5124136751280a07ebd91d5d04d93169d61 (diff)
* eina: rename ecore_file_ls_iterator to eina_file_ls.
SVN revision: 50002
Diffstat (limited to '')
-rw-r--r--legacy/ecore/src/lib/ecore_file/ecore_file.c81
1 files changed, 0 insertions, 81 deletions
diff --git a/legacy/ecore/src/lib/ecore_file/ecore_file.c b/legacy/ecore/src/lib/ecore_file/ecore_file.c
index fd4faa9e27..065f8bab19 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 *