summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2018-01-12 13:33:47 -0800
committerCedric BAIL <cedric@osg.samsung.com>2018-01-12 13:34:32 -0800
commit83b91fff02c84fc522fb6f126d4917de4e85ea14 (patch)
treeb4eb9f1853e478b013fe2a4144fbf8a9249f86bc
parentabc88c498e47380aec01369b3ce3526ae32c6cdf (diff)
downloadefl-83b91fff02c84fc522fb6f126d4917de4e85ea14.tar.gz
Evil: remove useless dirent code
Test Plan: compilation of the EFL Reviewers: cedric Subscribers: jpeg Differential Revision: https://phab.enlightenment.org/D5735 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r--src/Makefile_Evil.am2
-rw-r--r--src/lib/evil/dirent.h146
-rw-r--r--src/lib/evil/evil_dirent.c180
3 files changed, 0 insertions, 328 deletions
diff --git a/src/Makefile_Evil.am b/src/Makefile_Evil.am
index 6ec4b5113c..b5c7f02cb5 100644
--- a/src/Makefile_Evil.am
+++ b/src/Makefile_Evil.am
@@ -21,7 +21,6 @@ lib/evil/evil_string.h \
lib/evil/evil_time.h \
lib/evil/evil_unistd.h \
lib/evil/evil_util.h \
-lib/evil/dirent.h \
lib/evil/fnmatch.h \
lib/evil/pwd.h
@@ -30,7 +29,6 @@ dist_evilmmanheaders_DATA = \
lib/evil/sys/mman.h
lib_evil_libevil_la_SOURCES = \
-lib/evil/evil_dirent.c \
lib/evil/evil_dlfcn.c \
lib/evil/evil_fcntl.c \
lib/evil/evil_fnmatch.c \
diff --git a/src/lib/evil/dirent.h b/src/lib/evil/dirent.h
deleted file mode 100644
index 9c58019b52..0000000000
--- a/src/lib/evil/dirent.h
+++ /dev/null
@@ -1,146 +0,0 @@
-#ifndef __EVIL_DIRENT_H__
-#define __EVIL_DIRENT_H__
-
-#ifdef EAPI
-# undef EAPI
-#endif /* EAPI */
-
-#ifdef _WIN32
-# ifdef EFL_EVIL_BUILD
-# ifdef DLL_EXPORT
-# define EAPI __declspec(dllexport)
-# else
-# define EAPI
-# endif /* ! DLL_EXPORT */
-# else
-# define EAPI __declspec(dllimport)
-# endif /* ! EFL_EVIL_BUILD */
-#endif /* _WIN32 */
-
-
-/**
- * @file dirent.h
- * @brief The file that provides functions ported from Unix in dirent.h.
- * @defgroup Evil_Dirent_Group Dirent.h functions
- * @ingroup Evil
- *
- * This header provides functions ported from Unix in dirent.h.
- *
- * @{
- */
-
-
-#ifdef UNICODE
-# include <wchar.h>
-#endif
-
-/**
- * @def DT_UNKNOWN
- * Specifies that the file type is unknown.
- */
-#define DT_UNKNOWN 0
-
-/**
- * @def DT_DIR
- * Specifies that the file type is a directory.
- */
-#define DT_DIR 4
-
-/**
- * @typedef DIR
- * @brief A structure that describes a directory stream.
- */
-typedef struct DIR DIR;
-
-/**
- * @struct dirent
- * @brief A structure that describes a directory stream.
- */
-struct dirent
-{
- char d_name[260 + 1]; /**< The filename. */
- int d_mode; /**< The mode */
- unsigned char d_type; /**< The type */
-};
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-/**
- * @brief Open the given directory.
- *
- * @param name The directory to open.
- * @return A pointer to the directory stream.
- *
- * This function opens the directory @p name and return the directory
- * stream. On error or if @p dir is NULL, -1 is returned, and errno is
- * set appropriately (on Windows XP only). On success, 0 is returned.
- *
- * @see closedir()
- * @see readdir()
- *
- * Conformity: None.
- *
- * Supported OS: Windows XP, CE.
- */
-EAPI DIR *opendir(char const *name);
-
-/**
- * @brief Close the given directory.
- *
- * @param dir The directory stream to close.
- * @return A pointer to the directory stream.
- *
- * This function closes the stream directory @p dir. On error or is
- * @p path is NULL or an empty string, NULL is returned, and errno is set
- * appropriately (on Windows XP only).
- *
- * @see opendir()
- * @see readdir()
- *
- * Conformity: None.
- *
- * Supported OS: Windows XP, CE.
- */
-EAPI int closedir(DIR *dir);
-
-/**
- * @brief Read the given directory.
- *
- * @param dir The directory stream to read.
- * @return A pointer to a dirent structure, @c NULL oterhwise.
- *
- * This function returns a pointer to a dirent structure representing
- * the next directory entry in the directory stream pointed to by
- * @p dir. It returns NULL on reaching the end of the directory stream
- * or if an error occurred and errno is set appropriately (on Windows XP only).
- *
- * @see opendir()
- * @see readdir()
- *
- * Conformity: None.
- *
- * Supported OS: Windows XP, CE.
- */
-EAPI struct dirent *readdir(DIR *dir);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#undef EAPI
-#define EAPI
-
-
-
-/**
- * @}
- */
-
-
-#endif /* __EVIL_DIRENT_H__ */
diff --git a/src/lib/evil/evil_dirent.c b/src/lib/evil/evil_dirent.c
deleted file mode 100644
index 6f6b86a738..0000000000
--- a/src/lib/evil/evil_dirent.c
+++ /dev/null
@@ -1,180 +0,0 @@
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif /* HAVE_CONFIG_H */
-
-#include <stdlib.h>
-#include <dirent.h>
-#include <errno.h>
-#include <sys/types.h>
-
-#ifndef WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN
-#endif
-#include <windows.h>
-#undef WIN32_LEAN_AND_MEAN
-
-#include "evil_macro.h"
-#include "evil_stdio.h"
-
-
-struct DIR
-{
- struct dirent dirent;
- WIN32_FIND_DATA data;
- HANDLE handle;
-};
-
-
-DIR *opendir(char const *name)
-{
- DIR *dir;
- char *tmp;
- DWORD attr;
- size_t l;
-#ifdef UNICODE
- wchar_t *wname;
- char *d_name;
-#endif
-
- /* valid name */
- if (!name || !*name)
- {
- errno = ENOENT;
- return NULL;
- }
-
-#ifdef UNICODE
- wname = evil_char_to_wchar(name);
- if (!wname)
- {
- errno = ENOMEM;
- return NULL;
- }
-
- if((attr = GetFileAttributes(wname)) == 0xFFFFFFFF)
-#else
- if((attr = GetFileAttributes(name)) == 0xFFFFFFFF)
-#endif
- {
- errno = ENOENT;
- return NULL;
- }
-
-#ifdef UNICODE
- free(wname);
-#endif
-
- /* directory */
- if (!(attr & FILE_ATTRIBUTE_DIRECTORY))
- {
- errno = ENOTDIR;
- return NULL;
- }
-
- dir = (DIR *)malloc(sizeof(DIR));
- if (!dir)
- {
- errno = ENOMEM;
- return NULL;
- }
-
- l = strlen(name);
- tmp = (char *)malloc(sizeof(char) * l + 5);
- if (!tmp)
- {
- errno = ENOMEM;
- free(dir);
- return NULL;
- }
-
- memcpy(tmp, name, l);
- memcpy(tmp + l, "\\*.*", 5);
-
- EVIL_PATH_SEP_UNIX_TO_WIN32(tmp);
-
-#ifdef UNICODE
- wname = evil_char_to_wchar(tmp);
- if (!wname)
- {
- errno = ENOMEM;
- free(tmp);
- free(dir);
- return NULL;
- }
- dir->handle = FindFirstFile(wname, &dir->data);
- free(wname);
-#else
- dir->handle = FindFirstFile(tmp, &dir->data);
-#endif
-
- free(tmp);
-
- if (dir->handle == INVALID_HANDLE_VALUE)
- {
- free(dir);
- return NULL;
- }
-
-#ifdef UNICODE
- d_name = evil_wchar_to_char(dir->data.cFileName);
- strcpy(dir->dirent.d_name, d_name);
- free(d_name);
-#else
- strcpy(dir->dirent.d_name, dir->data.cFileName);
-#endif
- dir->dirent.d_mode = (int)dir->data.dwFileAttributes;
-
- if (dir->data.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY)
- dir->dirent.d_type = DT_DIR;
- else
- dir->dirent.d_type = DT_UNKNOWN;
-
- return dir;
-}
-
-int closedir(DIR *dir)
-{
- if (!dir)
- {
- errno = EBADF;
- return -1;
- }
-
- if (dir->handle != INVALID_HANDLE_VALUE)
- FindClose(dir->handle);
- free(dir);
-
- return 0;
-}
-
-struct dirent *readdir(DIR *dir)
-{
-#ifdef UNICODE
- char *d_name;
-#endif
-
- if (!dir)
- {
- errno = EBADF;
- return NULL;
- }
-
- if (dir->handle == INVALID_HANDLE_VALUE)
- return NULL;
-
-#ifdef UNICODE
- d_name = evil_wchar_to_char(dir->data.cFileName);
- strcpy(dir->dirent.d_name, d_name);
- free(d_name);
-#else
- strcpy(dir->dirent.d_name, dir->data.cFileName);
-#endif
-
- if (!FindNextFile(dir->handle, &dir->data))
- {
- FindClose(dir->handle);
- dir->handle = INVALID_HANDLE_VALUE;
- }
-
- return &dir->dirent;
-}