summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2017-09-14 15:52:49 +0200
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2017-09-14 15:53:30 +0200
commit518ca72d06451fb05f981f6bfe9e326e86ea6a88 (patch)
tree2ef9a23f4620c9f6556158b66abed282f78a40ad /src/lib
parent14ef6c2ba4c54b078f582ca312f7eaca9a43198f (diff)
eolian: default free funcs for builtin types
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/eolian/database_validate.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c
index 87d3202b89..dde30db11c 100644
--- a/src/lib/eolian/database_validate.c
+++ b/src/lib/eolian/database_validate.c
@@ -131,6 +131,18 @@ _validate_typedecl(Eolian_Typedecl *tp)
131 return EINA_TRUE; 131 return EINA_TRUE;
132} 132}
133 133
134static const char * const eo_complex_frees[] =
135{
136 "eina_accessor_free", "eina_array_free", "eina_iterator_free",
137 "eina_hash_free", "eina_list_free",
138
139 "efl_del" /* future */
140};
141
142static const char *eo_obj_free = "efl_del";
143static const char *eo_str_free = "free";
144static const char *eo_strshare_free = "eina_stringshare_del";
145
134static Eina_Bool 146static Eina_Bool
135_validate_type(Eolian_Type *tp) 147_validate_type(Eolian_Type *tp)
136{ 148{
@@ -146,7 +158,13 @@ _validate_type(Eolian_Type *tp)
146 { 158 {
147 case EOLIAN_TYPE_VOID: 159 case EOLIAN_TYPE_VOID:
148 case EOLIAN_TYPE_UNDEFINED: 160 case EOLIAN_TYPE_UNDEFINED:
161 return EINA_TRUE;
149 case EOLIAN_TYPE_COMPLEX: 162 case EOLIAN_TYPE_COMPLEX:
163 if (!tp->freefunc)
164 {
165 tp->freefunc = eina_stringshare_add(eo_complex_frees[
166 eo_lexer_keyword_str_to_id(tp->full_name) - KW_accessor]);
167 }
150 return EINA_TRUE; 168 return EINA_TRUE;
151 case EOLIAN_TYPE_REGULAR: 169 case EOLIAN_TYPE_REGULAR:
152 { 170 {
@@ -154,7 +172,23 @@ _validate_type(Eolian_Type *tp)
154 /* builtins */ 172 /* builtins */
155 int id = eo_lexer_keyword_str_to_id(tp->full_name); 173 int id = eo_lexer_keyword_str_to_id(tp->full_name);
156 if (id) 174 if (id)
157 return eo_lexer_is_type_keyword(id); 175 {
176 if (!eo_lexer_is_type_keyword(id))
177 return EINA_FALSE;
178 if (!tp->freefunc)
179 switch (id)
180 {
181 case KW_string:
182 tp->freefunc = eina_stringshare_add(eo_str_free);
183 break;
184 case KW_stringshare:
185 tp->freefunc = eina_stringshare_add(eo_strshare_free);
186 break;
187 default:
188 break;
189 }
190 return EINA_TRUE;
191 }
158 /* user defined */ 192 /* user defined */
159 tpp = (Eolian_Typedecl *)eolian_type_typedecl_get(tp); 193 tpp = (Eolian_Typedecl *)eolian_type_typedecl_get(tp);
160 if (!tpp) 194 if (!tpp)
@@ -189,7 +223,7 @@ _validate_type(Eolian_Type *tp)
189 return _type_error(tp, buf); 223 return _type_error(tp, buf);
190 } 224 }
191 if (!tp->freefunc) 225 if (!tp->freefunc)
192 tp->freefunc = eina_stringshare_add("efl_del"); 226 tp->freefunc = eina_stringshare_add(eo_obj_free);
193 return EINA_TRUE; 227 return EINA_TRUE;
194 } 228 }
195 default: 229 default: