eolian: fix error handling and memory leaks
This commit is contained in:
parent
07dcaadb97
commit
74181192ad
|
@ -382,11 +382,11 @@ int main(int argc, char **argv)
|
||||||
ERR("Bad generation option\n");
|
ERR("Bad generation option\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
free(output_filename);
|
|
||||||
}
|
}
|
||||||
else ret = 0;
|
else ret = 0;
|
||||||
|
|
||||||
end:
|
end:
|
||||||
|
free(output_filename);
|
||||||
eina_list_free(files4gen);
|
eina_list_free(files4gen);
|
||||||
|
|
||||||
eina_log_timing(_eolian_gen_log_dom,
|
eina_log_timing(_eolian_gen_log_dom,
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
static void
|
static void
|
||||||
eo_definitions_ret_free(Eo_Ret_Def *ret)
|
eo_definitions_ret_free(Eo_Ret_Def *ret)
|
||||||
{
|
{
|
||||||
|
if (ret->type) database_type_del(ret->type);
|
||||||
if (ret->comment) eina_stringshare_del(ret->comment);
|
if (ret->comment) eina_stringshare_del(ret->comment);
|
||||||
if (ret->dflt_ret_val) eina_stringshare_del(ret->dflt_ret_val);
|
if (ret->dflt_ret_val) eina_stringshare_del(ret->dflt_ret_val);
|
||||||
free(ret);
|
free(ret);
|
||||||
|
@ -15,6 +16,7 @@ eo_definitions_ret_free(Eo_Ret_Def *ret)
|
||||||
static void
|
static void
|
||||||
eo_definitions_param_free(Eo_Param_Def *param)
|
eo_definitions_param_free(Eo_Param_Def *param)
|
||||||
{
|
{
|
||||||
|
if (param->type) database_type_del(param->type);
|
||||||
if (param->name) eina_stringshare_del(param->name);
|
if (param->name) eina_stringshare_del(param->name);
|
||||||
if (param->comment) eina_stringshare_del(param->comment);
|
if (param->comment) eina_stringshare_del(param->comment);
|
||||||
free(param);
|
free(param);
|
||||||
|
@ -117,6 +119,9 @@ eo_definitions_type_def_free(Eo_Type_Def *type)
|
||||||
if (type->alias)
|
if (type->alias)
|
||||||
eina_stringshare_del(type->alias);
|
eina_stringshare_del(type->alias);
|
||||||
|
|
||||||
|
if (type->type)
|
||||||
|
database_type_del(type->type);
|
||||||
|
|
||||||
free(type);
|
free(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -287,12 +287,6 @@ eo_lexer_get_ident(Eo_Lexer *ls, const char *chars)
|
||||||
return (ls->t.token = lex(ls, &ls->t.value, &ls->t.kw, chars));
|
return (ls->t.token = lex(ls, &ls->t.value, &ls->t.kw, chars));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
eo_lexer_setjmp(Eo_Lexer *ls)
|
|
||||||
{
|
|
||||||
return setjmp(ls->err_jmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
eo_lexer_lex_error(Eo_Lexer *ls, const char *msg, int token)
|
eo_lexer_lex_error(Eo_Lexer *ls, const char *msg, int token)
|
||||||
{
|
{
|
||||||
|
|
|
@ -66,7 +66,6 @@ int eo_lexer_get (Eo_Lexer *ls);
|
||||||
int eo_lexer_get_ident (Eo_Lexer *ls, const char *chars);
|
int eo_lexer_get_ident (Eo_Lexer *ls, const char *chars);
|
||||||
int eo_lexer_lookahead (Eo_Lexer *ls);
|
int eo_lexer_lookahead (Eo_Lexer *ls);
|
||||||
int eo_lexer_lookahead_ident(Eo_Lexer *ls, const char *chars);
|
int eo_lexer_lookahead_ident(Eo_Lexer *ls, const char *chars);
|
||||||
int eo_lexer_setjmp (Eo_Lexer *ls);
|
|
||||||
void eo_lexer_lex_error (Eo_Lexer *ls, const char *msg, int token);
|
void eo_lexer_lex_error (Eo_Lexer *ls, const char *msg, int token);
|
||||||
void eo_lexer_syntax_error (Eo_Lexer *ls, const char *msg);
|
void eo_lexer_syntax_error (Eo_Lexer *ls, const char *msg);
|
||||||
void eo_lexer_token_to_str (int token, char *buf);
|
void eo_lexer_token_to_str (int token, char *buf);
|
||||||
|
|
|
@ -1123,7 +1123,7 @@ eo_parser_dump(Eo_Lexer *ls)
|
||||||
Eina_Bool
|
Eina_Bool
|
||||||
eo_parser_walk(Eo_Lexer *ls)
|
eo_parser_walk(Eo_Lexer *ls)
|
||||||
{
|
{
|
||||||
if (!eo_lexer_setjmp(ls))
|
if (!setjmp(ls->err_jmp))
|
||||||
{
|
{
|
||||||
parse_chunk(ls);
|
parse_chunk(ls);
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
|
@ -1200,6 +1200,7 @@ eo_parser_database_fill(const char *filename)
|
||||||
EINA_LIST_FOREACH(meth->params, m, param)
|
EINA_LIST_FOREACH(meth->params, m, param)
|
||||||
{
|
{
|
||||||
database_method_parameter_add(foo_id, (Eolian_Parameter_Dir)param->way, param->type, param->name, param->comment);
|
database_method_parameter_add(foo_id, (Eolian_Parameter_Dir)param->way, param->type, param->name, param->comment);
|
||||||
|
param->type = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1212,12 +1213,14 @@ eo_parser_database_fill(const char *filename)
|
||||||
Eolian_Function_Parameter p = database_property_key_add(
|
Eolian_Function_Parameter p = database_property_key_add(
|
||||||
foo_id, param->type, param->name, param->comment);
|
foo_id, param->type, param->name, param->comment);
|
||||||
database_parameter_nonull_set(p, param->nonull);
|
database_parameter_nonull_set(p, param->nonull);
|
||||||
|
param->type = NULL;
|
||||||
}
|
}
|
||||||
EINA_LIST_FOREACH(prop->values, m, param)
|
EINA_LIST_FOREACH(prop->values, m, param)
|
||||||
{
|
{
|
||||||
Eolian_Function_Parameter p = database_property_value_add(
|
Eolian_Function_Parameter p = database_property_value_add(
|
||||||
foo_id, param->type, param->name, param->comment);
|
foo_id, param->type, param->name, param->comment);
|
||||||
database_parameter_nonull_set(p, param->nonull);
|
database_parameter_nonull_set(p, param->nonull);
|
||||||
|
param->type = NULL;
|
||||||
}
|
}
|
||||||
EINA_LIST_FOREACH(prop->accessors, m, accessor)
|
EINA_LIST_FOREACH(prop->accessors, m, accessor)
|
||||||
{
|
{
|
||||||
|
@ -1233,6 +1236,7 @@ eo_parser_database_fill(const char *filename)
|
||||||
ftype, accessor->ret->warn_unused);
|
ftype, accessor->ret->warn_unused);
|
||||||
database_function_return_dflt_val_set(foo_id,
|
database_function_return_dflt_val_set(foo_id,
|
||||||
ftype, accessor->ret->dflt_ret_val);
|
ftype, accessor->ret->dflt_ret_val);
|
||||||
|
accessor->ret->type = NULL;
|
||||||
}
|
}
|
||||||
if (accessor->legacy)
|
if (accessor->legacy)
|
||||||
{
|
{
|
||||||
|
@ -1276,6 +1280,7 @@ eo_parser_database_fill(const char *filename)
|
||||||
EOLIAN_METHOD, meth->ret->warn_unused);
|
EOLIAN_METHOD, meth->ret->warn_unused);
|
||||||
database_function_return_dflt_val_set(foo_id,
|
database_function_return_dflt_val_set(foo_id,
|
||||||
EOLIAN_METHOD, meth->ret->dflt_ret_val);
|
EOLIAN_METHOD, meth->ret->dflt_ret_val);
|
||||||
|
meth->ret->type = NULL;
|
||||||
}
|
}
|
||||||
database_function_description_set(foo_id, EOLIAN_COMMENT, meth->comment);
|
database_function_description_set(foo_id, EOLIAN_COMMENT, meth->comment);
|
||||||
database_function_data_set(foo_id, EOLIAN_LEGACY, meth->legacy);
|
database_function_data_set(foo_id, EOLIAN_LEGACY, meth->legacy);
|
||||||
|
@ -1285,6 +1290,7 @@ eo_parser_database_fill(const char *filename)
|
||||||
Eolian_Function_Parameter p = database_method_parameter_add(foo_id,
|
Eolian_Function_Parameter p = database_method_parameter_add(foo_id,
|
||||||
(Eolian_Parameter_Dir)param->way, param->type, param->name, param->comment);
|
(Eolian_Parameter_Dir)param->way, param->type, param->name, param->comment);
|
||||||
database_parameter_nonull_set(p, param->nonull);
|
database_parameter_nonull_set(p, param->nonull);
|
||||||
|
param->type = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue