From 49822ec28d7901676135c42bc63e8adb09294842 Mon Sep 17 00:00:00 2001 From: Daniel Zaoui Date: Mon, 3 Mar 2014 18:00:45 +0200 Subject: [PATCH] Eolian: remove Ecore_File dependency --- configure.ac | 1 - src/bin/eolian/main.c | 40 ++++++++++++++++++++++------------------ src/lib/eolian/eo_lexer.rl | 6 ------ 3 files changed, 22 insertions(+), 25 deletions(-) diff --git a/configure.ac b/configure.ac index 2a8f2d4..28c7ef8 100644 --- a/configure.ac +++ b/configure.ac @@ -1011,7 +1011,6 @@ EFL_PLATFORM_DEPEND([EOLIAN], [evil]) ### Checks for libraries EFL_INTERNAL_DEPEND_PKG([EOLIAN], [eina]) -EFL_INTERNAL_DEPEND_PKG([EOLIAN], [ecore-file]) ### Checks for header files diff --git a/src/bin/eolian/main.c b/src/bin/eolian/main.c index 6fe3e9d..4a294e4 100644 --- a/src/bin/eolian/main.c +++ b/src/bin/eolian/main.c @@ -1,7 +1,6 @@ #include #include -#include #include "Eolian.h" #include "legacy_generator.h" @@ -31,6 +30,17 @@ _include_guard_enclose(const char *fname, const char *fbody) return eina_strbuf_string_steal(incguard); } +static const char * +_filename_get(const char *path) +{ + char *result = NULL; + + if (!path) return NULL; + if ((result = strrchr(path, '/'))) result++; + else result = (char *)path; + return result; +} + static Eina_Bool _generate_h_file(char *filename, const char *classname, Eina_Bool append) { @@ -74,7 +84,7 @@ _generate_h_file(char *filename, const char *classname, Eina_Bool append) if (htext) { - char *fcontent = _include_guard_enclose(ecore_file_file_get(filename), htext); + char *fcontent = _include_guard_enclose(_filename_get(filename), htext); fputs(fcontent, fd); free(fcontent); } @@ -161,7 +171,7 @@ _generate_legacy_header_file(char *filename, const char *classname, Eina_Bool ap if (ltext) { - char *fcontent = _include_guard_enclose(ecore_file_file_get(filename), ltext); + char *fcontent = _include_guard_enclose(_filename_get(filename), ltext); fputs(fcontent, fd); free(fcontent); } @@ -276,25 +286,19 @@ int main(int argc, char **argv) case 'I': { const char *dir = optarg; - if (ecore_file_is_dir(dir)) + Eina_Iterator *dir_files; + char *file; + /* Get all files from directory. Not recursively!!! */ + dir_files = eina_file_ls(dir); + EINA_ITERATOR_FOREACH(dir_files, file) { - Eina_List *dir_files; - char *file; - /* Get all files from directory. Not recursively!!!*/ - dir_files = ecore_file_ls(dir); - EINA_LIST_FREE(dir_files, file) + if (eina_str_has_suffix(file, EO_SUFFIX)) { - char *filepath = malloc(strlen(dir) + 1 + strlen(file) + 1); - sprintf(filepath, "%s/%s", dir, file); - if ((!ecore_file_is_dir(filepath)) && eina_str_has_suffix(filepath, EO_SUFFIX)) - { - /* Allocated string will be freed during deletion of "included_files" list. */ - included_files = eina_list_append(included_files, strdup(filepath)); - } - free(filepath); - free(file); + /* Allocated string will be freed during deletion of "included_files" list. */ + included_files = eina_list_append(included_files, strdup(file)); } } + eina_iterator_free(dir_files); break; } default: help = EINA_TRUE; diff --git a/src/lib/eolian/eo_lexer.rl b/src/lib/eolian/eo_lexer.rl index 917d50e..13f326f 100644 --- a/src/lib/eolian/eo_lexer.rl +++ b/src/lib/eolian/eo_lexer.rl @@ -1,6 +1,5 @@ #include #include -#include #include #include "eo_lexer.h" @@ -1134,11 +1133,6 @@ eo_tokenizer_database_fill(const char *filename) return EINA_FALSE; } - if (access(filename, F_OK) != 0) - { - ERR("error accessing file %s : %s", filename, strerror(errno)); - return EINA_FALSE; - } if (!eo_tokenizer_walk(toknz, filename)) return EINA_FALSE; EINA_LIST_FOREACH(toknz->classes, k, kls) -- 2.7.4