q66 pushed a commit to branch master.

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

commit da90173936fca13d592ab0102bed1dacf421b0a2
Author: Daniel Kolesa <[email protected]>
Date:   Fri Jul 1 14:34:24 2016 +0100

    eolian: cleanup type serialization logic
---
 src/lib/eolian/database_type.c | 29 +++++++++++++----------------
 1 file changed, 13 insertions(+), 16 deletions(-)

diff --git a/src/lib/eolian/database_type.c b/src/lib/eolian/database_type.c
index d0e6423..8bc8b02 100644
--- a/src/lib/eolian/database_type.c
+++ b/src/lib/eolian/database_type.c
@@ -67,6 +67,15 @@ database_enum_add(Eolian_Typedecl *tp)
    database_decl_add(tp->full_name, EOLIAN_DECL_ENUM, tp->base.file, tp);
 }
 
+static void
+_buf_add_suffix(Eina_Strbuf *buf, const char *suffix)
+{
+   if (!suffix) return;
+   if (eina_strbuf_string_get(buf)[eina_strbuf_length_get(buf) - 1] != '*')
+     eina_strbuf_append_char(buf, ' ');
+   eina_strbuf_append(buf, suffix);
+}
+
 void
 database_type_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name)
 {
@@ -102,27 +111,15 @@ database_type_to_str(const Eolian_Type *tp, Eina_Strbuf 
*buf, const char *name)
    else
      {
         /* handles arrays and pointers as they all serialize to pointers */
-        Eolian_Type *btp = tp->base_type;
         database_type_to_str(tp->base_type, buf, NULL);
-        if (eina_strbuf_string_get(buf)[eina_strbuf_length_get(buf) - 1] != 
'*')
-           eina_strbuf_append_char(buf, ' ');
-        eina_strbuf_append_char(buf, '*');
+        _buf_add_suffix(buf, "*");
         if (tp->is_const) eina_strbuf_append(buf, " const");
      }
    if (tp->type == EOLIAN_TYPE_COMPLEX || tp->type == EOLIAN_TYPE_CLASS)
-     eina_strbuf_append(buf, " *");
+     _buf_add_suffix(buf, "*");
    if (tp->is_ref)
-     {
-        if (eina_strbuf_string_get(buf)[eina_strbuf_length_get(buf) - 1] != 
'*')
-          eina_strbuf_append_char(buf, ' ');
-        eina_strbuf_append_char(buf, '*');
-     }
-   if (name)
-     {
-        if (eina_strbuf_string_get(buf)[eina_strbuf_length_get(buf) - 1] != 
'*')
-          eina_strbuf_append_char(buf, ' ');
-        eina_strbuf_append(buf, name);
-     }
+     _buf_add_suffix(buf, "*");
+   _buf_add_suffix(buf, name);
 }
 
 static void

-- 


Reply via email to