eolian: fix default value handling for @by_ref types
We must check all pointerness first, and append NULL as default when that applies, because @by_ref is not carried in the typedecl info. Therefore, it would result in a false positive and try to make a zeroed struct, which we don't want.
This commit is contained in:
parent
b6815a2f99
commit
a5c7f92a52
|
@ -123,7 +123,7 @@ _append_defval(Eina_Strbuf *buf, const Eolian_Expression *exp, const Eolian_Type
|
|||
}
|
||||
/* default value or fallback */
|
||||
const Eolian_Type *btp = eolian_type_aliased_base_get(tp);
|
||||
if (eolian_type_is_ptr(btp))
|
||||
if (eolian_type_is_ptr(btp) || strchr(ctp, '*'))
|
||||
{
|
||||
eina_strbuf_append(buf, "NULL");
|
||||
return;
|
||||
|
@ -139,11 +139,6 @@ _append_defval(Eina_Strbuf *buf, const Eolian_Expression *exp, const Eolian_Type
|
|||
free(sn);
|
||||
return;
|
||||
}
|
||||
if (strchr(ctp, '*'))
|
||||
{
|
||||
eina_strbuf_append(buf, "NULL");
|
||||
return;
|
||||
}
|
||||
/* enums and remaining regulars... 0 should do */
|
||||
eina_strbuf_append(buf, "0");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue