jackdanielz pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=fd67c1692c9385c4edbc314d2edc12c13cf9e429

commit fd67c1692c9385c4edbc314d2edc12c13cf9e429
Author: Daniel Zaoui <[email protected]>
Date:   Tue Mar 11 15:17:12 2014 +0200

    Eolian/Generator: fix generation for return values.
    
    - Remove space between type and variable if a star is present.
    - Initialize return value to NULL before eo_do. It is needed in case the
    eo_do invocation fails (NULL object...).
    - Add const to the internal return value if needed.
---
 src/bin/eolian/eo1_generator.c    | 2 +-
 src/bin/eolian/legacy_generator.c | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/bin/eolian/eo1_generator.c b/src/bin/eolian/eo1_generator.c
index 0b02d5b..7ca7628 100644
--- a/src/bin/eolian/eo1_generator.c
+++ b/src/bin/eolian/eo1_generator.c
@@ -431,7 +431,7 @@ eo1_bind_func_generate(const char *classname, 
Eolian_Function funcid, Eolian_Fun
               ret_const?"const ":"",
               rettype, had_star?"":" ");
         Eina_Strbuf *ret_param = eina_strbuf_new();
-        if (rettype) eina_strbuf_append_printf(ret_param, "%s _%s = ", 
rettype, retname);
+        if (rettype) eina_strbuf_append_printf(ret_param, "%s%s%s_%s = ", 
ret_const?"const ":"", rettype, had_star?"":" ", retname);
         eina_strbuf_replace_all(fbody, "@#ret_param", 
eina_strbuf_string_get(ret_param));
         sprintf(tmpstr, "%s%s", ret_const?"const ":"", rettype);
         eina_strbuf_replace_all(fbody, "@#ret_type", tmpstr);
diff --git a/src/bin/eolian/legacy_generator.c 
b/src/bin/eolian/legacy_generator.c
index f7b2363..301886e 100644
--- a/src/bin/eolian/legacy_generator.c
+++ b/src/bin/eolian/legacy_generator.c
@@ -298,7 +298,9 @@ _eapi_func_generate(const char *classname, Eolian_Function 
funcid, Eolian_Functi
      {
         if (eina_strbuf_length_get(eoparam)) eina_strbuf_append(eoparam, ", ");
         Eina_Bool had_star = !!strchr(rettype, '*');
-        sprintf (tmpstr, "   %s%s%s%s;\n", ret_const?"const ":"", rettype, 
had_star?"":" ", retname);
+        sprintf (tmpstr, "   %s%s%s%s%s;\n",
+              ret_const?"const ":"", rettype, had_star?"":" ", retname,
+              had_star?" = NULL":"");
         eina_strbuf_append_printf(eoparam, "&%s", retname);
      }
 

-- 


Reply via email to