q66 pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=1ffdcda292e008d9d62be9a8da304decb5c6ffb0

commit 1ffdcda292e008d9d62be9a8da304decb5c6ffb0
Author: Daniel Kolesa <d.kol...@osg.samsung.com>
Date:   Fri May 22 16:53:21 2015 +0100

    eolian: simplify eolian_eo_file_parse
    
    This also moves the ctor stuff into database_fill,
    saving some loops when a class is already parsed.
---
 src/lib/eolian/database_fill.c   | 33 +++++++++++++++++++++++++
 src/lib/eolian/eolian_database.c | 52 ++++------------------------------------
 2 files changed, 38 insertions(+), 47 deletions(-)

diff --git a/src/lib/eolian/database_fill.c b/src/lib/eolian/database_fill.c
index 9a24a11..d07b8d4 100644
--- a/src/lib/eolian/database_fill.c
+++ b/src/lib/eolian/database_fill.c
@@ -212,6 +212,9 @@ _db_fill_class(Eolian_Class *cl)
 Eina_Bool
 eo_parser_database_fill(const char *filename, Eina_Bool eot)
 {
+   Eolian_Constructor *ctor;
+   Eolian_Implement *impl;
+   Eina_Iterator *itr;
    Eolian_Class *cl;
    Eo_Lexer *ls;
 
@@ -245,6 +248,36 @@ eo_parser_database_fill(const char *filename, Eina_Bool 
eot)
    if (!_db_fill_class(cl))
      goto error;
 
+   itr = eolian_class_implements_get(cl);
+   EINA_ITERATOR_FOREACH(itr, impl)
+     {
+        Eolian_Function_Type impl_type = EOLIAN_UNRESOLVED;
+        const Eolian_Function *impl_func = eolian_implement_function_get(impl, 
&impl_type);
+        if (!impl_func)
+          {
+             fprintf(stderr, "eolian: unable to find function '%s'\n",
+                     eolian_implement_full_name_get(impl));
+             goto error;
+          }
+        else if (eolian_function_is_constructor(impl->foo_id, impl->klass))
+          database_function_constructor_add((Eolian_Function*)impl->foo_id, 
cl);
+     }
+   eina_iterator_free(itr);
+   itr = eolian_class_constructors_get(cl);
+   EINA_ITERATOR_FOREACH(itr, ctor)
+     {
+        const Eolian_Function *ctor_func = 
eolian_constructor_function_get(ctor);
+        if (!ctor_func)
+          {
+             fprintf(stderr, "eolian: unable to find function '%s'\n",
+                     eolian_constructor_full_name_get(ctor));
+             goto error;
+          }
+        else
+          database_function_constructor_add((Eolian_Function*)ctor_func, 
ctor->klass);
+     }
+   eina_iterator_free(itr);
+
 done:
    if (eot)
      eina_hash_set(_parsedeots, filename, (void *)EINA_TRUE);
diff --git a/src/lib/eolian/eolian_database.c b/src/lib/eolian/eolian_database.c
index 7a03487..1b0fc06 100644
--- a/src/lib/eolian/eolian_database.c
+++ b/src/lib/eolian/eolian_database.c
@@ -216,61 +216,19 @@ eolian_eot_file_parse(const char *filepath)
 EAPI Eina_Bool
 eolian_eo_file_parse(const char *filepath)
 {
-   Eina_Iterator *itr;
+   char *bfiledup, *bfilename;
 
    if (_database_init_count <= 0)
      return EINA_FALSE;
 
-   char *bfiledup = strdup(filepath);
-   char *bfilename = basename(bfiledup);
-   const Eolian_Class *class = eolian_class_get_by_file(bfilename);
-   Eolian_Implement *impl;
-   Eolian_Constructor *ctor;
-   if (!class)
-     {
-        if (!eo_parser_database_fill(filepath, EINA_FALSE))
-          {
-             free(bfiledup);
-             goto error;
-          }
-        class = eolian_class_get_by_file(bfilename);
-     }
-   else
+   bfiledup = strdup(filepath);
+   bfilename = basename(bfiledup);
+   if (!eolian_class_get_by_file(bfilename) && 
!eo_parser_database_fill(filepath, EINA_FALSE))
      {
         free(bfiledup);
-        return EINA_TRUE;
+        goto error;
      }
    free(bfiledup);
-   itr = eolian_class_implements_get(class);
-   EINA_ITERATOR_FOREACH(itr, impl)
-     {
-        Eolian_Function_Type impl_type = EOLIAN_UNRESOLVED;
-        const Eolian_Function *impl_func = eolian_implement_function_get(impl, 
&impl_type);
-        if (!impl_func)
-          {
-             fprintf(stderr, "eolian: unable to find function '%s'\n",
-                     eolian_implement_full_name_get(impl));
-             goto error;
-          }
-        else if (eolian_function_is_constructor(impl->foo_id, impl->klass))
-          database_function_constructor_add((Eolian_Function*)impl->foo_id, 
class);
-     }
-   eina_iterator_free(itr);
-   itr = eolian_class_constructors_get(class);
-   EINA_ITERATOR_FOREACH(itr, ctor)
-     {
-        const Eolian_Function *ctor_func = 
eolian_constructor_function_get(ctor);
-        if (!ctor_func)
-          {
-             fprintf(stderr, "eolian: unable to find function '%s'\n",
-                     eolian_constructor_full_name_get(ctor));
-             goto error;
-          }
-        else
-          database_function_constructor_add((Eolian_Function*)ctor_func, 
ctor->klass);
-     }
-   eina_iterator_free(itr);
-
    return EINA_TRUE;
 
 error:

-- 


Reply via email to