summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2019-09-10 14:25:03 +0200
committerDaniel Kolesa <d.kolesa@samsung.com>2019-09-10 14:25:03 +0200
commita5c7f92a52db98291e381e306842ea147631e103 (patch)
tree030780ff0b2b0420ab737f4fee9f612f896c665c
parentb6815a2f998846fa0c53da3a142d406041109bf0 (diff)
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.
-rw-r--r--src/bin/eolian/sources.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/bin/eolian/sources.c b/src/bin/eolian/sources.c
index fd0c32bb07..dd4b1f29ef 100644
--- a/src/bin/eolian/sources.c
+++ b/src/bin/eolian/sources.c
@@ -123,7 +123,7 @@ _append_defval(Eina_Strbuf *buf, const Eolian_Expression *exp, const Eolian_Type
123 } 123 }
124 /* default value or fallback */ 124 /* default value or fallback */
125 const Eolian_Type *btp = eolian_type_aliased_base_get(tp); 125 const Eolian_Type *btp = eolian_type_aliased_base_get(tp);
126 if (eolian_type_is_ptr(btp)) 126 if (eolian_type_is_ptr(btp) || strchr(ctp, '*'))
127 { 127 {
128 eina_strbuf_append(buf, "NULL"); 128 eina_strbuf_append(buf, "NULL");
129 return; 129 return;
@@ -139,11 +139,6 @@ _append_defval(Eina_Strbuf *buf, const Eolian_Expression *exp, const Eolian_Type
139 free(sn); 139 free(sn);
140 return; 140 return;
141 } 141 }
142 if (strchr(ctp, '*'))
143 {
144 eina_strbuf_append(buf, "NULL");
145 return;
146 }
147 /* enums and remaining regulars... 0 should do */ 142 /* enums and remaining regulars... 0 should do */
148 eina_strbuf_append(buf, "0"); 143 eina_strbuf_append(buf, "0");
149} 144}