From 9e02ad37bc39cb5e1360f4fcc52238834c54c4ff Mon Sep 17 00:00:00 2001 From: cedric Date: Tue, 2 Nov 2010 15:11:05 +0000 Subject: [PATCH] * eina: remove dirent so apps don't rely on non portable code. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/eina@54103 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/include/eina_file.h | 1 - src/lib/eina_file.c | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/include/eina_file.h b/src/include/eina_file.h index 30425ae..0452b79 100644 --- a/src/include/eina_file.h +++ b/src/include/eina_file.h @@ -76,7 +76,6 @@ struct _Eina_File_Direct_Info size_t name_length; /**< size of the filename/basename component */ size_t name_start; /**< where the filename/basename component starts */ char path[PATH_MAX]; /**< the path */ - const struct dirent *dirent; /**< the dirent structure of the path - don't use this if you want compatibility */ Eina_File_Type type; /**< file type */ }; diff --git a/src/lib/eina_file.c b/src/lib/eina_file.c index 4c32d75..af6f65c 100644 --- a/src/lib/eina_file.c +++ b/src/lib/eina_file.c @@ -101,11 +101,11 @@ _eina_file_ls_iterator_next(Eina_File_Iterator *it, void **data) ((dp->d_name[1] == '\0') || ((dp->d_name[1] == '.') && (dp->d_name[2] == '\0')))); -#ifdef _DIRENT_HAVE_D_NAMLEN +#ifdef _DIRENT_HAVE_D_NAMLEN length = dp->d_namlen; #else length = strlen(dp->d_name); -#endif +#endif name = alloca(length + 2 + it->length); memcpy(name, it->dir, it->length); @@ -162,11 +162,11 @@ _eina_file_direct_ls_iterator_next(Eina_File_Direct_Iterator *it, void **data) if (!dp) return EINA_FALSE; -#ifdef _DIRENT_HAVE_D_NAMLEN +#ifdef _DIRENT_HAVE_D_NAMLEN length = dp->d_namlen; #else length = strlen(dp->d_name); -#endif +#endif if (it->info.name_start + length + 1 >= PATH_MAX) continue; } @@ -178,7 +178,7 @@ _eina_file_direct_ls_iterator_next(Eina_File_Direct_Iterator *it, void **data) it->info.name_length = length; it->info.path_length = it->info.name_start + length; it->info.path[it->info.path_length] = '\0'; - it->info.dirent = dp; + #ifdef _DIRENT_HAVE_D_TYPE switch (dp->d_type) { -- 2.7.4