summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2015-05-22 17:14:38 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2015-05-22 17:14:38 +0100
commitd5599521172af414beb63ad52d68830e0c6fa1f4 (patch)
tree5705dc00d2f2fd62629492d3512dcc3989b20536
parent5d5b60b026e1d6582e1bff9cc4fe03eea114a64c (diff)
eolian: reuse the parsed eot hash for eo too (simplify code)
-rw-r--r--src/lib/eolian/database_fill.c5
-rw-r--r--src/lib/eolian/eolian_database.c22
-rw-r--r--src/lib/eolian/eolian_database.h2
3 files changed, 7 insertions, 22 deletions
diff --git a/src/lib/eolian/database_fill.c b/src/lib/eolian/database_fill.c
index d07b8d4465..2d43b6cf7d 100644
--- a/src/lib/eolian/database_fill.c
+++ b/src/lib/eolian/database_fill.c
@@ -218,7 +218,7 @@ eo_parser_database_fill(const char *filename, Eina_Bool eot)
218 Eolian_Class *cl; 218 Eolian_Class *cl;
219 Eo_Lexer *ls; 219 Eo_Lexer *ls;
220 220
221 if (eot && eina_hash_find(_parsedeots, filename)) 221 if (eina_hash_find(_parsedeos, filename))
222 return EINA_TRUE; 222 return EINA_TRUE;
223 223
224 eina_hash_set(_parsingeos, filename, (void *)EINA_TRUE); 224 eina_hash_set(_parsingeos, filename, (void *)EINA_TRUE);
@@ -279,8 +279,7 @@ eo_parser_database_fill(const char *filename, Eina_Bool eot)
279 eina_iterator_free(itr); 279 eina_iterator_free(itr);
280 280
281done: 281done:
282 if (eot) 282 eina_hash_set(_parsedeos, filename, (void *)EINA_TRUE);
283 eina_hash_set(_parsedeots, filename, (void *)EINA_TRUE);
284 eina_hash_set(_parsingeos, filename, (void *)EINA_FALSE); 283 eina_hash_set(_parsingeos, filename, (void *)EINA_FALSE);
285 284
286 eo_lexer_free(ls); 285 eo_lexer_free(ls);
diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c
index 1b0fc06649..5daa6d715c 100644
--- a/src/lib/eolian/eolian_database.c
+++ b/src/lib/eolian/eolian_database.c
@@ -23,7 +23,7 @@ Eina_Hash *_filenames = NULL;
23Eina_Hash *_tfilenames = NULL; 23Eina_Hash *_tfilenames = NULL;
24Eina_Hash *_decls = NULL; 24Eina_Hash *_decls = NULL;
25 25
26Eina_Hash *_parsedeots = NULL; 26Eina_Hash *_parsedeos = NULL;
27Eina_Hash *_parsingeos = NULL; 27Eina_Hash *_parsingeos = NULL;
28 28
29static int _database_init_count = 0; 29static int _database_init_count = 0;
@@ -54,7 +54,7 @@ database_init()
54 _filenames = eina_hash_string_small_new(free); 54 _filenames = eina_hash_string_small_new(free);
55 _tfilenames = eina_hash_string_small_new(free); 55 _tfilenames = eina_hash_string_small_new(free);
56 _decls = eina_hash_stringshared_new(free); 56 _decls = eina_hash_stringshared_new(free);
57 _parsedeots = eina_hash_string_small_new(NULL); 57 _parsedeos = eina_hash_string_small_new(NULL);
58 _parsingeos = eina_hash_string_small_new(NULL); 58 _parsingeos = eina_hash_string_small_new(NULL);
59 return ++_database_init_count; 59 return ++_database_init_count;
60} 60}
@@ -86,7 +86,7 @@ database_shutdown()
86 eina_hash_free(_filenames ); _filenames = NULL; 86 eina_hash_free(_filenames ); _filenames = NULL;
87 eina_hash_free(_tfilenames); _tfilenames = NULL; 87 eina_hash_free(_tfilenames); _tfilenames = NULL;
88 eina_hash_free(_decls ); _decls = NULL; 88 eina_hash_free(_decls ); _decls = NULL;
89 eina_hash_free(_parsedeots); _parsedeots = NULL; 89 eina_hash_free(_parsedeos ); _parsedeos = NULL;
90 eina_hash_free(_parsingeos); _parsingeos = NULL; 90 eina_hash_free(_parsingeos); _parsingeos = NULL;
91 eina_shutdown(); 91 eina_shutdown();
92 } 92 }
@@ -216,23 +216,9 @@ eolian_eot_file_parse(const char *filepath)
216EAPI Eina_Bool 216EAPI Eina_Bool
217eolian_eo_file_parse(const char *filepath) 217eolian_eo_file_parse(const char *filepath)
218{ 218{
219 char *bfiledup, *bfilename;
220
221 if (_database_init_count <= 0) 219 if (_database_init_count <= 0)
222 return EINA_FALSE; 220 return EINA_FALSE;
223 221 return eo_parser_database_fill(filepath, EINA_FALSE);
224 bfiledup = strdup(filepath);
225 bfilename = basename(bfiledup);
226 if (!eolian_class_get_by_file(bfilename) && !eo_parser_database_fill(filepath, EINA_FALSE))
227 {
228 free(bfiledup);
229 goto error;
230 }
231 free(bfiledup);
232 return EINA_TRUE;
233
234error:
235 return EINA_FALSE;
236} 222}
237 223
238static Eina_Bool _tfile_parse(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, void *data, void *fdata) 224static Eina_Bool _tfile_parse(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, void *data, void *fdata)
diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h
index 6783050d02..9bc76d4bf9 100644
--- a/src/lib/eolian/eolian_database.h
+++ b/src/lib/eolian/eolian_database.h
@@ -50,7 +50,7 @@ extern Eina_Hash *_tfilenames;
50extern Eina_Hash *_decls; 50extern Eina_Hash *_decls;
51 51
52/* holds parsed/currently parsing eot files to keep track */ 52/* holds parsed/currently parsing eot files to keep track */
53extern Eina_Hash *_parsedeots; 53extern Eina_Hash *_parsedeos;
54extern Eina_Hash *_parsingeos; 54extern Eina_Hash *_parsingeos;
55 55
56typedef struct _Eolian_Object 56typedef struct _Eolian_Object