summaryrefslogtreecommitdiff
path: root/src/lib/ecore/ecore_internal.h
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2020-01-24 10:59:01 -0800
committerCedric BAIL <cedric.bail@free.fr>2020-01-31 10:11:35 -0800
commiteaeb96cc3d11b6f107aef822ef6f0fbae5ceaa03 (patch)
tree84ddefa79e0e074fb1d6e55643b3cae0da9de003 /src/lib/ecore/ecore_internal.h
parent5d20a3bc6db0071c6fe063553d59b946917315dd (diff)
ecore: refactor unpacking/packing code used in conjonction with eina_future_all*.
Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D11184
Diffstat (limited to 'src/lib/ecore/ecore_internal.h')
-rw-r--r--src/lib/ecore/ecore_internal.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/lib/ecore/ecore_internal.h b/src/lib/ecore/ecore_internal.h
index 32a9472188..9f6e55eb24 100644
--- a/src/lib/ecore/ecore_internal.h
+++ b/src/lib/ecore/ecore_internal.h
@@ -129,6 +129,39 @@ _efl_composite_lookup(const Efl_Class *self, Eo *parent, Efl_Model *view, unsign
129 EFL_COMPOSITE_REMEMBER_RETURN(remember, view); 129 EFL_COMPOSITE_REMEMBER_RETURN(remember, view);
130} 130}
131 131
132/* Result from eina_future_all_* is an EINA_VALUE_TYPE_ARRAY that contain Eina_Value of
133 Eo Model. It is expected that children slice get return an EINA_VALUE_TYPE_ARRAY that
134 contain Eo Model directly.
135*/
136static inline Eina_Value
137_efl_future_all_repack(Eo *o EINA_UNUSED, void *data EINA_UNUSED, const Eina_Value v)
138{
139 unsigned int i, len;
140 Eina_Value created = EINA_VALUE_EMPTY;
141 Eina_Value r = EINA_VALUE_EMPTY;
142
143 eina_value_array_setup(&r, EINA_VALUE_TYPE_OBJECT, 4);
144
145 EINA_VALUE_ARRAY_FOREACH(&v, len, i, created)
146 {
147 Eo *target = NULL;
148
149 if (eina_value_type_get(&created) != EINA_VALUE_TYPE_OBJECT)
150 goto on_error;
151
152 target = eina_value_object_get(&created);
153 if (!target) goto on_error;
154
155 eina_value_array_append(&r, target);
156 }
157
158 return r;
159
160 on_error:
161 eina_value_flush(&r);
162 return eina_value_error_init(EFL_MODEL_ERROR_UNKNOWN);
163}
164
132#undef EAPI 165#undef EAPI
133#define EAPI 166#define EAPI
134 167