eolian: reuse the parsed eot hash for eo too (simplify code)
authorDaniel Kolesa <d.kolesa@osg.samsung.com>
Fri, 22 May 2015 16:14:38 +0000 (17:14 +0100)
committerDaniel Kolesa <d.kolesa@osg.samsung.com>
Fri, 22 May 2015 16:14:38 +0000 (17:14 +0100)
src/lib/eolian/database_fill.c
src/lib/eolian/eolian_database.c
src/lib/eolian/eolian_database.h

index d07b8d4..2d43b6c 100644 (file)
@@ -218,7 +218,7 @@ eo_parser_database_fill(const char *filename, Eina_Bool eot)
    Eolian_Class *cl;
    Eo_Lexer *ls;
 
-   if (eot && eina_hash_find(_parsedeots, filename))
+   if (eina_hash_find(_parsedeos, filename))
      return EINA_TRUE;
 
    eina_hash_set(_parsingeos, filename, (void *)EINA_TRUE);
@@ -279,8 +279,7 @@ eo_parser_database_fill(const char *filename, Eina_Bool eot)
    eina_iterator_free(itr);
 
 done:
-   if (eot)
-     eina_hash_set(_parsedeots, filename, (void *)EINA_TRUE);
+   eina_hash_set(_parsedeos, filename, (void *)EINA_TRUE);
    eina_hash_set(_parsingeos, filename, (void *)EINA_FALSE);
 
    eo_lexer_free(ls);
index 1b0fc06..5daa6d7 100644 (file)
@@ -23,7 +23,7 @@ Eina_Hash *_filenames  = NULL;
 Eina_Hash *_tfilenames = NULL;
 Eina_Hash *_decls      = NULL;
 
-Eina_Hash *_parsedeots = NULL;
+Eina_Hash *_parsedeo = NULL;
 Eina_Hash *_parsingeos = NULL;
 
 static int _database_init_count = 0;
@@ -54,7 +54,7 @@ database_init()
    _filenames  = eina_hash_string_small_new(free);
    _tfilenames = eina_hash_string_small_new(free);
    _decls      = eina_hash_stringshared_new(free);
-   _parsedeots = eina_hash_string_small_new(NULL);
+   _parsedeo = eina_hash_string_small_new(NULL);
    _parsingeos = eina_hash_string_small_new(NULL);
    return ++_database_init_count;
 }
@@ -86,7 +86,7 @@ database_shutdown()
         eina_hash_free(_filenames ); _filenames  = NULL;
         eina_hash_free(_tfilenames); _tfilenames = NULL;
         eina_hash_free(_decls     ); _decls      = NULL;
-        eina_hash_free(_parsedeots); _parsedeots = NULL;
+        eina_hash_free(_parsedeos ); _parsedeos  = NULL;
         eina_hash_free(_parsingeos); _parsingeos = NULL;
         eina_shutdown();
      }
@@ -216,23 +216,9 @@ eolian_eot_file_parse(const char *filepath)
 EAPI Eina_Bool
 eolian_eo_file_parse(const char *filepath)
 {
-   char *bfiledup, *bfilename;
-
    if (_database_init_count <= 0)
      return EINA_FALSE;
-
-   bfiledup = strdup(filepath);
-   bfilename = basename(bfiledup);
-   if (!eolian_class_get_by_file(bfilename) && !eo_parser_database_fill(filepath, EINA_FALSE))
-     {
-        free(bfiledup);
-        goto error;
-     }
-   free(bfiledup);
-   return EINA_TRUE;
-
-error:
-   return EINA_FALSE;
+   return eo_parser_database_fill(filepath, EINA_FALSE);
 }
 
 static Eina_Bool _tfile_parse(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, void *data, void *fdata)
index 6783050..9bc76d4 100644 (file)
@@ -50,7 +50,7 @@ extern Eina_Hash *_tfilenames;
 extern Eina_Hash *_decls;
 
 /* holds parsed/currently parsing eot files to keep track */
-extern Eina_Hash *_parsedeots;
+extern Eina_Hash *_parsedeos;
 extern Eina_Hash *_parsingeos;
 
 typedef struct _Eolian_Object