summaryrefslogtreecommitdiff
path: root/src/tests/eldbus/eldbus_test_eldbus_model.c
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-06-03 16:52:03 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-06-03 17:22:12 -0300
commit8fec0d5139a3ff30037ba159bb62ff2f733d96a8 (patch)
tree0316d756b8150e9ef40d76668e5084fdb06af29a /src/tests/eldbus/eldbus_test_eldbus_model.c
parent1dcccfdf8160ca6113d66c51c226302221b9a049 (diff)
eina: Remove unnecessary indirection to promises
Now when dealing with pointer types, we will not get pointer to pointer semantics in callbacks and eina_promise_owner_value_set for Eina_Promise. It will work as expected: Eina_Promise_Owner* promise = eina_promise_add(); void* p = malloc(sizeof(T)); eina_promise_owner_value_set(promise, p, &free);
Diffstat (limited to '')
-rw-r--r--src/tests/eldbus/eldbus_test_eldbus_model.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/tests/eldbus/eldbus_test_eldbus_model.c b/src/tests/eldbus/eldbus_test_eldbus_model.c
index 68398ca11f..8dd1c07aa2 100644
--- a/src/tests/eldbus/eldbus_test_eldbus_model.c
+++ b/src/tests/eldbus/eldbus_test_eldbus_model.c
@@ -15,21 +15,23 @@
15#include "eldbus_suite.h" 15#include "eldbus_suite.h"
16 16
17static void 17static void
18_promise_then_quit_cb(void **data , void **value, Eina_Promise* promise EINA_UNUSED) 18_promise_then_quit_cb(void *data , void *value, Eina_Promise* promise EINA_UNUSED)
19{ 19{
20 *data = *value; 20 *(void**)data = value;
21 ecore_main_loop_quit(); 21 ecore_main_loop_quit();
22} 22}
23 23
24static void 24static void
25_promise_then_quit_u_cb(unsigned *data , unsigned *value, Eina_Promise* promise EINA_UNUSED) 25_promise_then_quit_u_cb(void *data , void *value, Eina_Promise* promise EINA_UNUSED)
26{ 26{
27 *data = *value; 27 unsigned *lhs = data;
28 unsigned *rhs = value;
29 *lhs = *rhs;
28 ecore_main_loop_quit(); 30 ecore_main_loop_quit();
29} 31}
30 32
31static void 33static void
32_promise_then_cp(Eina_Value *data , void *value, Eina_Promise* promise EINA_UNUSED) 34_promise_then_cp(void *data , void *value, Eina_Promise* promise EINA_UNUSED)
33{ 35{
34 eina_value_copy(value, data); 36 eina_value_copy(value, data);
35 ecore_main_loop_quit(); 37 ecore_main_loop_quit();
@@ -73,7 +75,7 @@ void *
73efl_model_promise_then(Eina_Promise *promise) 75efl_model_promise_then(Eina_Promise *promise)
74{ 76{
75 void *data = NULL; 77 void *data = NULL;
76 eina_promise_then(promise, (Eina_Promise_Cb)&_promise_then_quit_cb, &_error_then_cb, &data); 78 eina_promise_then(promise, &_promise_then_quit_cb, &_error_then_cb, &data);
77 ecore_main_loop_begin(); 79 ecore_main_loop_begin();
78 return data; 80 return data;
79} 81}
@@ -89,7 +91,7 @@ int
89efl_model_promise_then_u(Eina_Promise *promise) 91efl_model_promise_then_u(Eina_Promise *promise)
90{ 92{
91 unsigned i = 0; 93 unsigned i = 0;
92 eina_promise_then(promise, (Eina_Promise_Cb)&_promise_then_quit_u_cb, &_error_then_cb, &i); 94 eina_promise_then(promise, &_promise_then_quit_u_cb, &_error_then_cb, &i);
93 ecore_main_loop_begin(); 95 ecore_main_loop_begin();
94 return i; 96 return i;
95} 97}
@@ -407,7 +409,7 @@ check_efl_model_property_int_eq(Efl_Model *efl_model, const char *property, int
407 efl_model_property_get(efl_model, property, &promise); 409 efl_model_property_get(efl_model, property, &promise);
408 ck_assert_ptr_ne(NULL, promise); 410 ck_assert_ptr_ne(NULL, promise);
409 411
410 eina_promise_then(promise, (Eina_Promise_Cb)&_promise_then_cp, &_error_then_cb, &property_value); 412 eina_promise_then(promise, &_promise_then_cp, &_error_then_cb, &property_value);
411 ecore_main_loop_begin(); 413 ecore_main_loop_begin();
412 414
413 const Eina_Value_Type *property_type = eina_value_type_get(&property_value); 415 const Eina_Value_Type *property_type = eina_value_type_get(&property_value);
@@ -429,7 +431,7 @@ check_efl_model_property_int_set(Efl_Model *efl_model, const char *property, int
429 eina_value_set(&eina_value, value); 431 eina_value_set(&eina_value, value);
430 efl_model_property_set(efl_model, property, &eina_value, &promise); 432 efl_model_property_set(efl_model, property, &eina_value, &promise);
431 433
432 eina_promise_then(promise, (Eina_Promise_Cb)&_promise_then_cp, &_error_then_cb, &value_ret); 434 eina_promise_then(promise, &_promise_then_cp, &_error_then_cb, &value_ret);
433 ecore_main_loop_begin(); 435 ecore_main_loop_begin();
434 436
435 const Eina_Value_Type *property_type = eina_value_type_get(&value_ret); 437 const Eina_Value_Type *property_type = eina_value_type_get(&value_ret);