forked from enlightenment/efl
eolian_gen: void out keys depending on how they are setted
this avoid warings about keys not beeing used in the fallback function. Reviewed-by: Daniel Kolesa <daniel@octaforge.org> Differential Revision: https://phab.enlightenment.org/D7630
This commit is contained in:
parent
2b1285c9db
commit
5a11fd8587
|
@ -267,6 +267,50 @@ _generate_iterative_free(Eina_Strbuf **buf, const Eolian_Type *type, const Eolia
|
|||
eina_strbuf_free(iter_param);
|
||||
}
|
||||
|
||||
static int
|
||||
_gen_function_param_fallback(Eina_Iterator *itr, Eina_Strbuf *fallback_free_ownership, Eina_Strbuf *param_call)
|
||||
{
|
||||
Eolian_Function_Parameter *pr;
|
||||
int owners = 0;
|
||||
|
||||
EINA_ITERATOR_FOREACH(itr, pr)
|
||||
{
|
||||
const Eolian_Type *type, *inner_type;
|
||||
|
||||
type = eolian_parameter_type_get(pr);
|
||||
inner_type = eolian_type_base_type_get(type);
|
||||
|
||||
//check if they should be freed or just ignored
|
||||
if (!eolian_type_is_owned(type) || eolian_parameter_direction_get(pr) == EOLIAN_OUT_PARAM)
|
||||
{
|
||||
eina_strbuf_append_printf(fallback_free_ownership, " (void)%s;\n", eolian_parameter_name_get(pr));
|
||||
continue;
|
||||
}
|
||||
|
||||
owners ++;
|
||||
|
||||
eina_strbuf_reset(param_call);
|
||||
|
||||
if (eolian_parameter_direction_get(pr) == EOLIAN_INOUT_PARAM)
|
||||
eina_strbuf_append_char(param_call, '*');
|
||||
eina_strbuf_append(param_call, eolian_parameter_name_get(pr));
|
||||
|
||||
//check if we might want to free or handle the children
|
||||
if (!inner_type || !eolian_type_is_owned(inner_type))
|
||||
{
|
||||
_generate_normal_free(&fallback_free_ownership, type, param_call, "");
|
||||
}
|
||||
else if (inner_type && eolian_type_is_owned(inner_type))
|
||||
{
|
||||
_generate_iterative_free(&fallback_free_ownership, type, inner_type, pr, param_call);
|
||||
}
|
||||
}
|
||||
eina_iterator_free(itr);
|
||||
|
||||
return owners;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_gen_func(const Eolian_Class *cl, const Eolian_Function *fid,
|
||||
Eolian_Function_Type ftype, Eina_Strbuf *buf,
|
||||
|
@ -356,50 +400,23 @@ _gen_func(const Eolian_Class *cl, const Eolian_Function *fid,
|
|||
else
|
||||
{
|
||||
Eina_Iterator *itr;
|
||||
Eolian_Function_Parameter *pr;
|
||||
int owners = 0;
|
||||
Eina_Strbuf *param_call;
|
||||
|
||||
param_call = eina_strbuf_new();
|
||||
|
||||
if (is_prop)
|
||||
itr = eolian_property_values_get(fid, ftype);
|
||||
else
|
||||
itr = eolian_function_parameters_get(fid);
|
||||
|
||||
EINA_ITERATOR_FOREACH(itr, pr)
|
||||
{
|
||||
const Eolian_Type *type, *inner_type;
|
||||
|
||||
type = eolian_parameter_type_get(pr);
|
||||
inner_type = eolian_type_base_type_get(type);
|
||||
|
||||
//check if they should be freed or just ignored
|
||||
if (!eolian_type_is_owned(type) || eolian_parameter_direction_get(pr) == EOLIAN_OUT_PARAM)
|
||||
{
|
||||
eina_strbuf_append_printf(fallback_free_ownership, " (void)%s;\n", eolian_parameter_name_get(pr));
|
||||
continue;
|
||||
}
|
||||
|
||||
owners ++;
|
||||
|
||||
eina_strbuf_reset(param_call);
|
||||
|
||||
if (eolian_parameter_direction_get(pr) == EOLIAN_INOUT_PARAM)
|
||||
eina_strbuf_append_char(param_call, '*');
|
||||
eina_strbuf_append(param_call, eolian_parameter_name_get(pr));
|
||||
|
||||
//check if we might want to free or handle the children
|
||||
if (!inner_type || !eolian_type_is_owned(inner_type))
|
||||
{
|
||||
_generate_normal_free(&fallback_free_ownership, type, param_call, "");
|
||||
}
|
||||
else if (inner_type && eolian_type_is_owned(inner_type))
|
||||
{
|
||||
_generate_iterative_free(&fallback_free_ownership, type, inner_type, pr, param_call);
|
||||
}
|
||||
itr = eolian_property_values_get(fid, ftype);
|
||||
owners += _gen_function_param_fallback(itr, fallback_free_ownership, param_call);
|
||||
itr = eolian_property_keys_get(fid, ftype);
|
||||
owners += _gen_function_param_fallback(itr, fallback_free_ownership, param_call);
|
||||
}
|
||||
else
|
||||
{
|
||||
itr = eolian_function_parameters_get(fid);
|
||||
owners += _gen_function_param_fallback(itr, fallback_free_ownership, param_call);
|
||||
}
|
||||
eina_iterator_free(itr);
|
||||
|
||||
if (owners == 0)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue