summaryrefslogtreecommitdiff
path: root/src/lib/eldbus
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2019-01-04 17:42:26 -0800
committerCedric BAIL <cedric.bail@free.fr>2019-01-16 14:33:26 -0800
commit563f91eaf98fff474a4858f2d81c6374f0d777b9 (patch)
tree2e3a8abf52d835da7a74d1285ae45a17410cd763 /src/lib/eldbus
parent40ca3fbe5813dfe0f2d0090f421c22a4cf2d8817 (diff)
ecore: remove data parameters of Efl.Loop_Consumer.promise_new to reduce the risk of inadvertently using the wrong data.
If you need data, use a efl_future_then as done in every case here to get the same feature. Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Differential Revision: https://phab.enlightenment.org/D7577
Diffstat (limited to 'src/lib/eldbus')
-rw-r--r--src/lib/eldbus/eldbus_model_connection.c2
-rw-r--r--src/lib/eldbus/eldbus_model_object.c2
-rw-r--r--src/lib/eldbus/eldbus_model_private.h7
-rw-r--r--src/lib/eldbus/eldbus_model_proxy.c11
4 files changed, 8 insertions, 14 deletions
diff --git a/src/lib/eldbus/eldbus_model_connection.c b/src/lib/eldbus/eldbus_model_connection.c
index a8f2d52..56a0673 100644
--- a/src/lib/eldbus/eldbus_model_connection.c
+++ b/src/lib/eldbus/eldbus_model_connection.c
@@ -70,7 +70,7 @@ _eldbus_model_connection_efl_model_children_slice_get(Eo *obj,
70 return efl_loop_future_resolved(obj, v); 70 return efl_loop_future_resolved(obj, v);
71 } 71 }
72 72
73 p = efl_loop_promise_new(obj, NULL, _eldbus_eina_promise_cancel, NULL); 73 p = efl_loop_promise_new(obj);
74 74
75 slice = calloc(1, sizeof (Eldbus_Children_Slice_Promise)); 75 slice = calloc(1, sizeof (Eldbus_Children_Slice_Promise));
76 slice->p = p; 76 slice->p = p;
diff --git a/src/lib/eldbus/eldbus_model_object.c b/src/lib/eldbus/eldbus_model_object.c
index b975514..1189629 100644
--- a/src/lib/eldbus/eldbus_model_object.c
+++ b/src/lib/eldbus/eldbus_model_object.c
@@ -127,7 +127,7 @@ _eldbus_model_object_efl_model_children_slice_get(Eo *obj EINA_UNUSED,
127 return efl_loop_future_resolved(obj, v); 127 return efl_loop_future_resolved(obj, v);
128 } 128 }
129 129
130 p = efl_loop_promise_new(obj, NULL, _eldbus_eina_promise_cancel, NULL); 130 p = efl_loop_promise_new(obj);
131 131
132 slice = calloc(1, sizeof(struct _Eldbus_Children_Slice_Promise)); 132 slice = calloc(1, sizeof(struct _Eldbus_Children_Slice_Promise));
133 slice->p = p; 133 slice->p = p;
diff --git a/src/lib/eldbus/eldbus_model_private.h b/src/lib/eldbus/eldbus_model_private.h
index e58a25d..bfe6d5e 100644
--- a/src/lib/eldbus/eldbus_model_private.h
+++ b/src/lib/eldbus/eldbus_model_private.h
@@ -39,13 +39,6 @@ struct _Eldbus_Model_Data
39/* logging support */ 39/* logging support */
40extern int eldbus_model_log_dom; 40extern int eldbus_model_log_dom;
41 41
42static inline void
43_eldbus_eina_promise_cancel(void *data EINA_UNUSED,
44 Efl_Loop_Consumer *consumer EINA_UNUSED,
45 const Eina_Promise *dead_ptr EINA_UNUSED)
46{
47}
48
49#define ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(exp, promise, err, v) \ 42#define ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(exp, promise, err, v) \
50 do \ 43 do \
51 { \ 44 { \
diff --git a/src/lib/eldbus/eldbus_model_proxy.c b/src/lib/eldbus/eldbus_model_proxy.c
index ca5cfc3..32253e3 100644
--- a/src/lib/eldbus/eldbus_model_proxy.c
+++ b/src/lib/eldbus/eldbus_model_proxy.c
@@ -229,9 +229,9 @@ eldbus_model_proxy_property_check(Eldbus_Model_Proxy_Data *pd,
229} 229}
230 230
231static void 231static void
232_eldbus_model_proxy_cancel_cb(void *data, 232_eldbus_model_proxy_cancel_cb(Efl_Loop_Consumer *consumer EINA_UNUSED,
233 Efl_Loop_Consumer *consumer EINA_UNUSED, 233 void *data,
234 const Eina_Promise *dead_promise EINA_UNUSED) 234 const Eina_Future *dead_future EINA_UNUSED)
235{ 235{
236 Eldbus_Model_Proxy_Property_Set_Data *sd = data; 236 Eldbus_Model_Proxy_Property_Set_Data *sd = data;
237 237
@@ -294,7 +294,7 @@ _eldbus_model_proxy_efl_model_property_set(Eo *obj EINA_UNUSED,
294 if (!data) goto on_error; 294 if (!data) goto on_error;
295 295
296 data->pd = pd; 296 data->pd = pd;
297 data->promise = efl_loop_promise_new(obj, data, _eldbus_model_proxy_cancel_cb, NULL); 297 data->promise = efl_loop_promise_new(obj);
298 data->property = eina_stringshare_add(property); 298 data->property = eina_stringshare_add(property);
299 if (!(data->value = eina_value_dup(value))) goto on_error; 299 if (!(data->value = eina_value_dup(value))) goto on_error;
300 300
@@ -310,7 +310,8 @@ _eldbus_model_proxy_efl_model_property_set(Eo *obj EINA_UNUSED,
310 } 310 }
311 311
312 if (pending) pd->pendings = eina_list_append(pd->pendings, pending); 312 if (pending) pd->pendings = eina_list_append(pd->pendings, pending);
313 return efl_future_then(obj, eina_future_new(data->promise)); 313 return efl_future_then(obj, eina_future_new(data->promise),
314 .data = data, .free = _eldbus_model_proxy_cancel_cb);
314 315
315 on_error: 316 on_error:
316 return efl_loop_future_rejected(obj, err); 317 return efl_loop_future_rejected(obj, err);