eolian: cleanup class fill
authorDaniel Kolesa <d.kolesa@samsung.com>
Thu, 11 Sep 2014 09:58:09 +0000 (10:58 +0100)
committerDaniel Kolesa <d.kolesa@samsung.com>
Thu, 11 Sep 2014 10:02:51 +0000 (11:02 +0100)
src/lib/eolian/database_class.c
src/lib/eolian/database_fill.c
src/lib/eolian/eo_parser.c
src/lib/eolian/eolian_database.h

index 01833ac6f144b4040ac6e02ab2c0366079c63a41..b7d2a0aa57e44c53580d4ed35202d0271901afb2 100644 (file)
@@ -37,31 +37,3 @@ database_class_del(Eolian_Class *cl)
 
    free(cl);
 }
-
-Eolian_Class *
-database_class_add(const char *class_name, Eolian_Class_Type type)
-{
-   char *full_name = strdup(class_name);
-   char *name = full_name;
-   char *colon = full_name;
-   Eolian_Class *cl = calloc(1, sizeof(*cl));
-   cl->full_name = eina_stringshare_add(class_name);
-   cl->type = type;
-   do
-     {
-        colon = strchr(colon, '.');
-        if (colon)
-          {
-             *colon = '\0';
-             cl->namespaces = eina_list_append(cl->namespaces,
-                                               eina_stringshare_add(name));
-             colon += 1;
-             name = colon;
-          }
-     }
-   while(colon);
-   cl->name = eina_stringshare_add(name);
-   eina_hash_set(_classes, cl->full_name, cl);
-   free(full_name);
-   return cl;
-}
index 33c6781b208f7a8aa050ecd9a2cd7da0d47451f2..6f271542933c3a8a9c49f8cefb5fc50a5a89af02 100644 (file)
@@ -254,12 +254,18 @@ _db_fill_events(Eolian_Class *cl, Eolian_Class *kls)
 static Eina_Bool
 _db_fill_class(Eolian_Class *kls)
 {
-   Eolian_Class *cl = database_class_add(kls->name, kls->type);
+   Eolian_Class *cl = calloc(1, sizeof(Eolian_Class));
    const char *s;
    Eina_List *l;
 
+   eina_hash_set(_classes, kls->full_name, cl);
    eina_hash_set(_classesf, kls->base.file, cl);
 
+   cl->namespaces = kls->namespaces; kls->namespaces = NULL;
+   cl->full_name = kls->full_name; kls->full_name = NULL;
+   cl->name = kls->name; kls->name = NULL;
+   cl->type = kls->type;
+
    if (kls->description)
      cl->description = eina_stringshare_ref(kls->description);
 
index 303299df375d94262e26717b3912f3dccc9c9eeb..2e567f1bf505b6f6aa0e16ebfe5c3212d26c4015 100644 (file)
@@ -1905,7 +1905,8 @@ parse_class(Eo_Lexer *ls, Eolian_Class_Type type)
         eo_lexer_syntax_error(ls, "class and file names differ");
      }
    eo_lexer_context_pop(ls);
-   ls->tmp.kls->name = eina_stringshare_add(eina_strbuf_string_get(buf));
+   _fill_class_name(ls->tmp.kls, eina_stringshare_add(eina_strbuf_string_get
+      (buf)));
    pop_strbuf(ls);
    if (ls->t.token != '{')
      {
index ab656cc91dc8ec5898b996c5103c65c2b28e46bc..844c71600779ab4ec8340152e5206c3ad2b49ff0 100644 (file)
@@ -272,8 +272,6 @@ void database_var_del(Eolian_Variable *var);
 Eina_Bool database_var_add(Eolian_Variable *var);
 
 /* classes */
-
-Eolian_Class *database_class_add(const char *class_name, Eolian_Class_Type type);
 void database_class_del(Eolian_Class *cl);
 
 /* functions */
@@ -283,11 +281,9 @@ void database_function_del(Eolian_Function *fid);
 void database_parameter_del(Eolian_Function_Parameter *pdesc);
 
 /* implements */
-
 void database_implement_del(Eolian_Implement *impl);
 
 /* constructors */
-
 void database_constructor_del(Eolian_Constructor *ctor);
 
 /* events */