forked from enlightenment/efl
eolian: refactoring: get rid of Eo_Implement_Def
This commit is contained in:
parent
7b9438e76e
commit
239e7524dc
|
@ -1,11 +1,10 @@
|
|||
#include <Eina.h>
|
||||
#include "eolian_database.h"
|
||||
|
||||
Eolian_Implement *
|
||||
database_implement_new(const char *impl_name)
|
||||
void
|
||||
database_implement_del(Eolian_Implement *impl)
|
||||
{
|
||||
Eolian_Implement *impl_desc = calloc(1, sizeof(Eolian_Implement));
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(impl_desc, NULL);
|
||||
impl_desc->full_name = eina_stringshare_add(impl_name);
|
||||
return impl_desc;
|
||||
if (!impl) return;
|
||||
if (impl->full_name) eina_stringshare_del(impl->full_name);
|
||||
free(impl);
|
||||
}
|
||||
|
|
|
@ -102,15 +102,6 @@ eo_definitions_event_def_free(Eo_Event_Def *sgn)
|
|||
free(sgn);
|
||||
}
|
||||
|
||||
static void
|
||||
eo_definitions_impl_def_free(Eo_Implement_Def *impl)
|
||||
{
|
||||
if (impl->meth_name)
|
||||
eina_stringshare_del(impl->meth_name);
|
||||
|
||||
free(impl);
|
||||
}
|
||||
|
||||
void
|
||||
eo_definitions_class_def_free(Eo_Class_Def *kls)
|
||||
{
|
||||
|
@ -118,7 +109,7 @@ eo_definitions_class_def_free(Eo_Class_Def *kls)
|
|||
Eo_Property_Def *prop;
|
||||
Eo_Method_Def *meth;
|
||||
Eo_Event_Def *sgn;
|
||||
Eo_Implement_Def *impl;
|
||||
Eolian_Implement *impl;
|
||||
|
||||
if (kls->name)
|
||||
eina_stringshare_del(kls->name);
|
||||
|
@ -135,7 +126,7 @@ eo_definitions_class_def_free(Eo_Class_Def *kls)
|
|||
if (s) eina_stringshare_del(s);
|
||||
|
||||
EINA_LIST_FREE(kls->implements, impl)
|
||||
eo_definitions_impl_def_free(impl);
|
||||
database_implement_del(impl);
|
||||
|
||||
EINA_LIST_FREE(kls->constructors, meth)
|
||||
eo_definitions_method_def_free(meth);
|
||||
|
@ -203,5 +194,5 @@ eo_definitions_temps_free(Eo_Lexer_Temps *tmp)
|
|||
eo_definitions_event_def_free(tmp->event);
|
||||
|
||||
if (tmp->impl)
|
||||
eo_definitions_impl_def_free(tmp->impl);
|
||||
database_implement_del(tmp->impl);
|
||||
}
|
||||
|
|
|
@ -99,13 +99,6 @@ typedef struct _Eo_Event_Def
|
|||
Eina_Stringshare *comment;
|
||||
} Eo_Event_Def;
|
||||
|
||||
/* IMPLEMENT */
|
||||
|
||||
typedef struct _Eo_Implement_Def
|
||||
{
|
||||
Eina_Stringshare *meth_name;
|
||||
} Eo_Implement_Def;
|
||||
|
||||
/* CLASS */
|
||||
|
||||
typedef struct _Eo_Class_Def
|
||||
|
@ -142,7 +135,7 @@ typedef struct _Eo_Lexer_Temps
|
|||
Eo_Accessor_Param *accessor_param;
|
||||
Eina_List *str_items;
|
||||
Eo_Event_Def *event;
|
||||
Eo_Implement_Def *impl;
|
||||
Eolian_Implement *impl;
|
||||
} Eo_Lexer_Temps;
|
||||
|
||||
void eo_definitions_class_def_free(Eo_Class_Def *kls);
|
||||
|
|
|
@ -705,9 +705,9 @@ static void
|
|||
parse_implement(Eo_Lexer *ls, Eina_Bool iface)
|
||||
{
|
||||
Eina_Strbuf *buf = NULL;
|
||||
Eo_Implement_Def *impl = NULL;
|
||||
Eolian_Implement *impl = NULL;
|
||||
buf = push_strbuf(ls);
|
||||
impl = calloc(1, sizeof(Eo_Implement_Def));
|
||||
impl = calloc(1, sizeof(Eolian_Implement));
|
||||
ls->tmp.impl = impl;
|
||||
if (iface)
|
||||
check_kw(ls, KW_class);
|
||||
|
@ -727,7 +727,7 @@ parse_implement(Eo_Lexer *ls, Eina_Bool iface)
|
|||
eina_strbuf_append(buf, "constructor");
|
||||
}
|
||||
check_next(ls, ';');
|
||||
impl->meth_name = eina_stringshare_add(eina_strbuf_string_get(buf));
|
||||
impl->full_name = eina_stringshare_add(eina_strbuf_string_get(buf));
|
||||
pop_strbuf(ls);
|
||||
return;
|
||||
}
|
||||
|
@ -755,7 +755,7 @@ parse_implement(Eo_Lexer *ls, Eina_Bool iface)
|
|||
}
|
||||
}
|
||||
check_next(ls, ';');
|
||||
impl->meth_name = eina_stringshare_add(eina_strbuf_string_get(buf));
|
||||
impl->full_name = eina_stringshare_add(eina_strbuf_string_get(buf));
|
||||
pop_strbuf(ls);
|
||||
return;
|
||||
}
|
||||
|
@ -790,7 +790,7 @@ parse_implement(Eo_Lexer *ls, Eina_Bool iface)
|
|||
}
|
||||
end:
|
||||
check_next(ls, ';');
|
||||
impl->meth_name = eina_stringshare_add(eina_strbuf_string_get(buf));
|
||||
impl->full_name = eina_stringshare_add(eina_strbuf_string_get(buf));
|
||||
pop_strbuf(ls);
|
||||
}
|
||||
|
||||
|
@ -1070,7 +1070,7 @@ _dump_class(Eo_Class_Def *kls)
|
|||
Eo_Param_Def *param;
|
||||
Eo_Accessor_Def *accessor;
|
||||
Eo_Event_Def *sgn;
|
||||
Eo_Implement_Def *impl;
|
||||
Eolian_Implement *impl;
|
||||
|
||||
printf("Class: %s (%s)\n",
|
||||
kls->name, (kls->comment ? kls->comment : "-"));
|
||||
|
@ -1080,7 +1080,7 @@ _dump_class(Eo_Class_Def *kls)
|
|||
printf("\n");
|
||||
printf(" implements:");
|
||||
EINA_LIST_FOREACH(kls->implements, l, impl)
|
||||
printf(" %s", impl->meth_name);
|
||||
printf(" %s", impl->full_name);
|
||||
printf("\n");
|
||||
printf(" events:\n");
|
||||
EINA_LIST_FOREACH(kls->events, l, sgn)
|
||||
|
@ -1208,7 +1208,7 @@ _db_fill_class(Eo_Class_Def *kls, const char *filename)
|
|||
Eo_Param_Def *param;
|
||||
Eo_Accessor_Def *accessor;
|
||||
Eo_Event_Def *event;
|
||||
Eo_Implement_Def *impl;
|
||||
Eolian_Implement *impl;
|
||||
|
||||
Eolian_Class *class = database_class_add(kls->name, kls->type);
|
||||
Eina_Bool is_iface = (kls->type == EOLIAN_CLASS_INTERFACE);
|
||||
|
@ -1345,7 +1345,7 @@ _db_fill_class(Eo_Class_Def *kls, const char *filename)
|
|||
|
||||
EINA_LIST_FOREACH(kls->implements, l, impl)
|
||||
{
|
||||
const char *impl_name = impl->meth_name;
|
||||
const char *impl_name = impl->full_name;
|
||||
if (!strcmp(impl_name, "class.constructor"))
|
||||
{
|
||||
database_class_ctor_enable_set(class, EINA_TRUE);
|
||||
|
@ -1382,8 +1382,8 @@ _db_fill_class(Eo_Class_Def *kls, const char *filename)
|
|||
database_function_set_as_virtual_pure(foo_id, ftype);
|
||||
continue;
|
||||
}
|
||||
Eolian_Implement *impl_desc = database_implement_new(impl_name);
|
||||
database_class_implement_add(class, impl_desc);
|
||||
database_class_implement_add(class, impl);
|
||||
eina_list_data_set(l, NULL); /* prevent double free */
|
||||
}
|
||||
|
||||
EINA_LIST_FOREACH(kls->events, l, event)
|
||||
|
|
|
@ -211,7 +211,7 @@ void database_parameter_nonull_set(Eolian_Function_Parameter *param, Eina_Bool n
|
|||
|
||||
/* implements */
|
||||
|
||||
Eolian_Implement *database_implement_new(const char *impl_name);
|
||||
void database_implement_del(Eolian_Implement *impl);
|
||||
|
||||
/* events */
|
||||
|
||||
|
|
Loading…
Reference in New Issue