summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2017-09-14 00:12:46 +0200
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2017-09-14 00:12:46 +0200
commit8ff2bf35fecf62157363f83f2e370394840f3d4f (patch)
treeeaf198f5f36014811c1ae6b7cef3c535fd2a2b79 /src
parentd05127eb1a929222121e9f92a15559dcf0c8790b (diff)
eolian: inherit freefunc between types/typedecls
Diffstat (limited to 'src')
-rw-r--r--src/lib/eolian/database_validate.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c
index 9519dee508..f8eb7fad73 100644
--- a/src/lib/eolian/database_validate.c
+++ b/src/lib/eolian/database_validate.c
@@ -50,7 +50,7 @@ _validate_doc(const Eolian_Documentation *doc)
50 return EINA_TRUE; 50 return EINA_TRUE;
51} 51}
52 52
53static Eina_Bool _validate_type(const Eolian_Type *tp); 53static Eina_Bool _validate_type(Eolian_Type *tp);
54static Eina_Bool _validate_expr(const Eolian_Expression *expr, 54static Eina_Bool _validate_expr(const Eolian_Expression *expr,
55 const Eolian_Type *tp, 55 const Eolian_Type *tp,
56 Eolian_Expression_Mask msk); 56 Eolian_Expression_Mask msk);
@@ -95,7 +95,7 @@ _type_error(const Eolian_Type *tp, const char *msg)
95} 95}
96 96
97static Eina_Bool 97static Eina_Bool
98_validate_typedecl(const Eolian_Typedecl *tp) 98_validate_typedecl(Eolian_Typedecl *tp)
99{ 99{
100 if (!_validate_doc(tp->doc)) 100 if (!_validate_doc(tp->doc))
101 return EINA_FALSE; 101 return EINA_FALSE;
@@ -103,7 +103,11 @@ _validate_typedecl(const Eolian_Typedecl *tp)
103 switch (tp->type) 103 switch (tp->type)
104 { 104 {
105 case EOLIAN_TYPEDECL_ALIAS: 105 case EOLIAN_TYPEDECL_ALIAS:
106 return _validate_type(tp->base_type); 106 if (!_validate_type(tp->base_type))
107 return EINA_FALSE;
108 if (!tp->freefunc && tp->base_type->freefunc)
109 tp->freefunc = eina_stringshare_ref(tp->base_type->freefunc);
110 return EINA_TRUE;
107 case EOLIAN_TYPEDECL_STRUCT: 111 case EOLIAN_TYPEDECL_STRUCT:
108 { 112 {
109 Eina_Bool succ = EINA_TRUE; 113 Eina_Bool succ = EINA_TRUE;
@@ -142,7 +146,7 @@ _type_is_terminatable(const Eolian_Type *tp)
142} 146}
143 147
144static Eina_Bool 148static Eina_Bool
145_validate_type(const Eolian_Type *tp) 149_validate_type(Eolian_Type *tp)
146{ 150{
147 char buf[256]; 151 char buf[256];
148 152
@@ -160,19 +164,23 @@ _validate_type(const Eolian_Type *tp)
160 return EINA_TRUE; 164 return EINA_TRUE;
161 case EOLIAN_TYPE_REGULAR: 165 case EOLIAN_TYPE_REGULAR:
162 { 166 {
163 const Eolian_Typedecl *tpp; 167 Eolian_Typedecl *tpp;
164 /* builtins */ 168 /* builtins */
165 int id = eo_lexer_keyword_str_to_id(tp->full_name); 169 int id = eo_lexer_keyword_str_to_id(tp->full_name);
166 if (id) 170 if (id)
167 return eo_lexer_is_type_keyword(id); 171 return eo_lexer_is_type_keyword(id);
168 /* user defined */ 172 /* user defined */
169 tpp = eolian_type_typedecl_get(tp); 173 tpp = (Eolian_Typedecl *)eolian_type_typedecl_get(tp);
170 if (!tpp) 174 if (!tpp)
171 { 175 {
172 snprintf(buf, sizeof(buf), "undefined type %s", tp->full_name); 176 snprintf(buf, sizeof(buf), "undefined type %s", tp->full_name);
173 return _type_error(tp, buf); 177 return _type_error(tp, buf);
174 } 178 }
175 return _validate_typedecl(tpp); 179 if (!_validate_typedecl(tpp))
180 return EINA_FALSE;
181 if (tpp->freefunc && !tp->freefunc)
182 tp->freefunc = eina_stringshare_ref(tpp->freefunc);
183 return EINA_TRUE;
176 } 184 }
177 case EOLIAN_TYPE_TERMINATED_ARRAY: 185 case EOLIAN_TYPE_TERMINATED_ARRAY:
178 if (!_type_is_terminatable(tp->base_type)) 186 if (!_type_is_terminatable(tp->base_type))
@@ -194,6 +202,8 @@ _validate_type(const Eolian_Type *tp)
194 "(likely wrong namespacing)", tp->full_name); 202 "(likely wrong namespacing)", tp->full_name);
195 return _type_error(tp, buf); 203 return _type_error(tp, buf);
196 } 204 }
205 if (!tp->freefunc)
206 tp->freefunc = eina_stringshare_add("efl_del");
197 return EINA_TRUE; 207 return EINA_TRUE;
198 } 208 }
199 default: 209 default:
@@ -341,7 +351,7 @@ _validate_variable(const Eolian_Variable *var)
341 351
342static Eina_Bool 352static Eina_Bool
343_typedecl_map_cb(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED, 353_typedecl_map_cb(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED,
344 const Eolian_Typedecl *tp, Eina_Bool *sc) 354 Eolian_Typedecl *tp, Eina_Bool *sc)
345{ 355{
346 return (*sc = _validate_typedecl(tp)); 356 return (*sc = _validate_typedecl(tp));
347} 357}