summaryrefslogtreecommitdiff
path: root/src/bin/eolian
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2019-09-02 15:05:34 +0200
committerDaniel Kolesa <d.kolesa@samsung.com>2019-09-02 15:24:14 +0200
commit2377a2c6673f3cd55ac2dc82abc2fad1e0d39686 (patch)
treef4d4e4500fec9ed00f6b81a4d0fd76860c3f75c9 /src/bin/eolian
parent595a0c0b2f528b4569385d208c2b4807e2a7e818 (diff)
eolian_gen: use new is_move APIs to check ownership transfers
Diffstat (limited to 'src/bin/eolian')
-rw-r--r--src/bin/eolian/headers.c9
-rw-r--r--src/bin/eolian/sources.c6
2 files changed, 9 insertions, 6 deletions
diff --git a/src/bin/eolian/headers.c b/src/bin/eolian/headers.c
index 3e433b5..f21ae2e 100644
--- a/src/bin/eolian/headers.c
+++ b/src/bin/eolian/headers.c
@@ -35,7 +35,7 @@ _gen_param(Eina_Strbuf *buf, Eolian_Function_Parameter *pr,
35 eina_strbuf_append(buf, _get_add_star(ftype, eolian_parameter_direction_get(pr))); 35 eina_strbuf_append(buf, _get_add_star(ftype, eolian_parameter_direction_get(pr)));
36 eina_strbuf_append(buf, prn); 36 eina_strbuf_append(buf, prn);
37 eina_stringshare_del(prtn); 37 eina_stringshare_del(prtn);
38 if (eolian_type_is_owned(eolian_parameter_type_get(pr))) 38 if (eolian_parameter_is_move(pr))
39 eina_strbuf_append(buf, " EFL_TRANSFER_OWNERSHIP"); 39 eina_strbuf_append(buf, " EFL_TRANSFER_OWNERSHIP");
40 *rpid = 0; 40 *rpid = 0;
41 return 1; 41 return 1;
@@ -82,13 +82,16 @@ _gen_func(const Eolian_State *state, const Eolian_Function *fid,
82 82
83 Eina_Bool var_as_ret = EINA_FALSE; 83 Eina_Bool var_as_ret = EINA_FALSE;
84 const Eolian_Type *rtp = eolian_function_return_type_get(fid, ftype); 84 const Eolian_Type *rtp = eolian_function_return_type_get(fid, ftype);
85 Eina_Bool return_move = eolian_function_return_is_move(fid, ftype);
85 if (ftype == EOLIAN_PROP_GET && !rtp) 86 if (ftype == EOLIAN_PROP_GET && !rtp)
86 { 87 {
87 void *d1, *d2; 88 void *d1, *d2;
88 Eina_Iterator *itr = eolian_property_values_get(fid, ftype); 89 Eina_Iterator *itr = eolian_property_values_get(fid, ftype);
89 if (eina_iterator_next(itr, &d1) && !eina_iterator_next(itr, &d2)) 90 if (eina_iterator_next(itr, &d1) && !eina_iterator_next(itr, &d2))
90 { 91 {
91 rtp = eolian_parameter_type_get((Eolian_Function_Parameter *)d1); 92 Eolian_Function_Parameter *pr = (Eolian_Function_Parameter *)d1;
93 rtp = eolian_parameter_type_get(pr);
94 return_move = eolian_parameter_is_move(pr);
92 var_as_ret = EINA_TRUE; 95 var_as_ret = EINA_TRUE;
93 } 96 }
94 eina_iterator_free(itr); 97 eina_iterator_free(itr);
@@ -168,7 +171,7 @@ _gen_func(const Eolian_State *state, const Eolian_Function *fid,
168 flagbuf = eina_strbuf_new(); 171 flagbuf = eina_strbuf_new();
169 eina_strbuf_prepend(flagbuf, " EINA_WARN_UNUSED_RESULT"); 172 eina_strbuf_prepend(flagbuf, " EINA_WARN_UNUSED_RESULT");
170 } 173 }
171 if (rtp && eolian_type_is_owned(rtp)) 174 if (return_move)
172 eina_strbuf_append(buf, " EFL_TRANSFER_OWNERSHIP"); 175 eina_strbuf_append(buf, " EFL_TRANSFER_OWNERSHIP");
173 if (flagbuf) 176 if (flagbuf)
174 { 177 {
diff --git a/src/bin/eolian/sources.c b/src/bin/eolian/sources.c
index 93d78eb..2c45163 100644
--- a/src/bin/eolian/sources.c
+++ b/src/bin/eolian/sources.c
@@ -314,7 +314,7 @@ _gen_function_param_fallback(Eina_Iterator *itr, Eina_Strbuf *fallback_free_owne
314 inner_type = eolian_type_base_type_get(type); 314 inner_type = eolian_type_base_type_get(type);
315 315
316 //check if they should be freed or just ignored 316 //check if they should be freed or just ignored
317 if (!eolian_type_is_owned(type) || eolian_parameter_direction_get(pr) == EOLIAN_OUT_PARAM) 317 if (!eolian_parameter_is_move(pr) || eolian_parameter_direction_get(pr) == EOLIAN_OUT_PARAM)
318 { 318 {
319 eina_strbuf_append_printf(fallback_free_ownership, " (void)%s;\n", eolian_parameter_name_get(pr)); 319 eina_strbuf_append_printf(fallback_free_ownership, " (void)%s;\n", eolian_parameter_name_get(pr));
320 continue; 320 continue;
@@ -329,11 +329,11 @@ _gen_function_param_fallback(Eina_Iterator *itr, Eina_Strbuf *fallback_free_owne
329 eina_strbuf_append(param_call, eolian_parameter_name_get(pr)); 329 eina_strbuf_append(param_call, eolian_parameter_name_get(pr));
330 330
331 //check if we might want to free or handle the children 331 //check if we might want to free or handle the children
332 if (!inner_type || !eolian_type_is_owned(inner_type)) 332 if (!inner_type || !eolian_type_is_move(inner_type))
333 { 333 {
334 _generate_normal_free(&fallback_free_ownership, type, param_call, ""); 334 _generate_normal_free(&fallback_free_ownership, type, param_call, "");
335 } 335 }
336 else if (inner_type && eolian_type_is_owned(inner_type)) 336 else if (inner_type && eolian_type_is_move(inner_type))
337 { 337 {
338 _generate_iterative_free(&fallback_free_ownership, type, inner_type, pr, param_call); 338 _generate_iterative_free(&fallback_free_ownership, type, inner_type, pr, param_call);
339 } 339 }