forked from enlightenment/efl
Eolian/Generator: return values set to 0.
Before eo_do invocation, generated legacy functions returning a value initialize it to 0. This change is needed in the case that eo_do fails to find some function, which leads to an unitialized value and behavior.
This commit is contained in:
parent
571d7b6287
commit
81c2a5d217
|
@ -298,9 +298,8 @@ _eapi_func_generate(const char *classname, Eolian_Function funcid, Eolian_Functi
|
||||||
{
|
{
|
||||||
if (eina_strbuf_length_get(eoparam)) eina_strbuf_append(eoparam, ", ");
|
if (eina_strbuf_length_get(eoparam)) eina_strbuf_append(eoparam, ", ");
|
||||||
Eina_Bool had_star = !!strchr(rettype, '*');
|
Eina_Bool had_star = !!strchr(rettype, '*');
|
||||||
sprintf (tmpstr, " %s%s%s%s%s;\n",
|
sprintf (tmpstr, " %s%s%s%s = 0;\n",
|
||||||
ret_const?"const ":"", rettype, had_star?"":" ", retname,
|
ret_const?"const ":"", rettype, had_star?"":" ", retname);
|
||||||
had_star?" = NULL":"");
|
|
||||||
eina_strbuf_append_printf(eoparam, "&%s", retname);
|
eina_strbuf_append_printf(eoparam, "&%s", retname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,10 +310,6 @@ _eapi_func_generate(const char *classname, Eolian_Function funcid, Eolian_Functi
|
||||||
eina_strbuf_replace_all(fbody, "@#ret_val", (rettype) ? retname : "");
|
eina_strbuf_replace_all(fbody, "@#ret_val", (rettype) ? retname : "");
|
||||||
eina_strbuf_replace_all(fbody, "@#is_const", (ftype == GET || eolian_function_object_is_const(funcid)) ? "const " : "");
|
eina_strbuf_replace_all(fbody, "@#is_const", (ftype == GET || eolian_function_object_is_const(funcid)) ? "const " : "");
|
||||||
|
|
||||||
tmpstr[0] = '\0';
|
|
||||||
if (rettype) sprintf (tmpstr, "(%s)(0)", rettype);
|
|
||||||
eina_strbuf_replace_all(fbody, "@#check_ret", tmpstr);
|
|
||||||
|
|
||||||
eina_strbuf_append(buf, eina_strbuf_string_get(fbody));
|
eina_strbuf_append(buf, eina_strbuf_string_get(fbody));
|
||||||
|
|
||||||
end:
|
end:
|
||||||
|
|
Loading…
Reference in New Issue