summaryrefslogtreecommitdiff
path: root/src/lib/eldbus
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/lib/eldbus
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 'src/lib/eldbus')
-rw-r--r--src/lib/eldbus/eldbus_model_arguments.c3
-rw-r--r--src/lib/eldbus/eldbus_model_connection.c4
-rw-r--r--src/lib/eldbus/eldbus_model_object.c11
-rw-r--r--src/lib/eldbus/eldbus_model_private.h2
-rw-r--r--src/lib/eldbus/eldbus_model_proxy.c2
5 files changed, 7 insertions, 15 deletions
diff --git a/src/lib/eldbus/eldbus_model_arguments.c b/src/lib/eldbus/eldbus_model_arguments.c
index 645125486f..91192c9411 100644
--- a/src/lib/eldbus/eldbus_model_arguments.c
+++ b/src/lib/eldbus/eldbus_model_arguments.c
@@ -136,7 +136,8 @@ _eldbus_model_arguments_efl_model_property_set(Eo *obj EINA_UNUSED,
136 136
137 eina_value_flush(prop_value); 137 eina_value_flush(prop_value);
138 eina_value_copy(value, prop_value); 138 eina_value_copy(value, prop_value);
139 eina_promise_owner_value_set(promise, prop_value, NULL); 139 eina_value_copy(value, eina_promise_owner_buffer_get(promise));
140 eina_promise_owner_value_set(promise, NULL, (Eina_Promise_Free_Cb)&eina_value_flush);
140} 141}
141 142
142static void 143static void
diff --git a/src/lib/eldbus/eldbus_model_connection.c b/src/lib/eldbus/eldbus_model_connection.c
index 591bc373f8..b05d9f7b34 100644
--- a/src/lib/eldbus/eldbus_model_connection.c
+++ b/src/lib/eldbus/eldbus_model_connection.c
@@ -149,7 +149,7 @@ _eldbus_model_connection_efl_model_children_slice_get(Eo *obj EINA_UNUSED,
149 if (pd->is_listed) 149 if (pd->is_listed)
150 { 150 {
151 Eina_Accessor *ac = efl_model_list_slice(pd->children_list, start, count); 151 Eina_Accessor *ac = efl_model_list_slice(pd->children_list, start, count);
152 eina_promise_owner_value_set(promise, &ac, (Eina_Promise_Free_Cb)&_accessor_free); 152 eina_promise_owner_value_set(promise, ac, (Eina_Promise_Free_Cb)&eina_accessor_free);
153 return; 153 return;
154 } 154 }
155 155
@@ -338,7 +338,7 @@ _eldbus_model_connection_names_list_cb(void *data,
338 EINA_LIST_FOREACH(pd->children_promises, i, p) 338 EINA_LIST_FOREACH(pd->children_promises, i, p)
339 { 339 {
340 Eina_Accessor *ac = efl_model_list_slice(pd->children_list, p->start, p->count); 340 Eina_Accessor *ac = efl_model_list_slice(pd->children_list, p->start, p->count);
341 eina_promise_owner_value_set(p->promise, &ac, (Eina_Promise_Free_Cb)&_accessor_free); 341 eina_promise_owner_value_set(p->promise, ac, (Eina_Promise_Free_Cb)&eina_accessor_free);
342 free(p); 342 free(p);
343 } 343 }
344 eina_list_free(pd->children_promises); 344 eina_list_free(pd->children_promises);
diff --git a/src/lib/eldbus/eldbus_model_object.c b/src/lib/eldbus/eldbus_model_object.c
index 9efc270779..b2ab91e05f 100644
--- a/src/lib/eldbus/eldbus_model_object.c
+++ b/src/lib/eldbus/eldbus_model_object.c
@@ -22,13 +22,6 @@ static void _eldbus_model_object_introspect_nodes(Eldbus_Model_Object_Data *, co
22static char *_eldbus_model_object_concatenate_path(const char *, const char *); 22static char *_eldbus_model_object_concatenate_path(const char *, const char *);
23static void _eldbus_model_object_create_children(Eldbus_Model_Object_Data *, Eldbus_Object *, Eina_List *); 23static void _eldbus_model_object_create_children(Eldbus_Model_Object_Data *, Eldbus_Object *, Eina_List *);
24 24
25void
26_accessor_free(void *data)
27{
28 Eina_Accessor **ac = data;
29 eina_accessor_free(*ac);
30}
31
32static Eo_Base* 25static Eo_Base*
33_eldbus_model_object_eo_base_constructor(Eo *obj, Eldbus_Model_Object_Data *pd) 26_eldbus_model_object_eo_base_constructor(Eo *obj, Eldbus_Model_Object_Data *pd)
34{ 27{
@@ -190,7 +183,7 @@ _eldbus_model_object_efl_model_children_slice_get(Eo *obj EINA_UNUSED,
190 if (pd->is_listed) 183 if (pd->is_listed)
191 { 184 {
192 Eina_Accessor* ac = efl_model_list_slice(pd->children_list, start, count); 185 Eina_Accessor* ac = efl_model_list_slice(pd->children_list, start, count);
193 eina_promise_owner_value_set(promise, &ac, &_accessor_free); 186 eina_promise_owner_value_set(promise, ac, (Eina_Promise_Free_Cb)&eina_accessor_free);
194 return; 187 return;
195 } 188 }
196 189
@@ -437,7 +430,7 @@ _eldbus_model_object_introspect_cb(void *data,
437 EINA_LIST_FOREACH(pd->children_promises, i, p) 430 EINA_LIST_FOREACH(pd->children_promises, i, p)
438 { 431 {
439 Eina_Accessor* ac = efl_model_list_slice(pd->children_list, p->start, p->count); 432 Eina_Accessor* ac = efl_model_list_slice(pd->children_list, p->start, p->count);
440 eina_promise_owner_value_set(p->promise, &ac, &_accessor_free); 433 eina_promise_owner_value_set(p->promise, ac, (Eina_Promise_Free_Cb)&eina_accessor_free);
441 free(p); 434 free(p);
442 } 435 }
443 eina_list_free(pd->children_promises); 436 eina_list_free(pd->children_promises);
diff --git a/src/lib/eldbus/eldbus_model_private.h b/src/lib/eldbus/eldbus_model_private.h
index 29d7bddb18..eed5deb234 100644
--- a/src/lib/eldbus/eldbus_model_private.h
+++ b/src/lib/eldbus/eldbus_model_private.h
@@ -23,8 +23,6 @@ struct _Eldbus_Property_Promise
23 Eina_Promise_Owner* promise; 23 Eina_Promise_Owner* promise;
24}; 24};
25 25
26void _accessor_free(void *data);
27
28/* logging support */ 26/* logging support */
29extern int eldbus_model_log_dom; 27extern int eldbus_model_log_dom;
30 28
diff --git a/src/lib/eldbus/eldbus_model_proxy.c b/src/lib/eldbus/eldbus_model_proxy.c
index 41a5f9b685..d6b104766f 100644
--- a/src/lib/eldbus/eldbus_model_proxy.c
+++ b/src/lib/eldbus/eldbus_model_proxy.c
@@ -233,7 +233,7 @@ _eldbus_model_proxy_efl_model_children_slice_get(Eo *obj EINA_UNUSED,
233 } 233 }
234 234
235 Eina_Accessor *ac = efl_model_list_slice(pd->children_list, start, count); 235 Eina_Accessor *ac = efl_model_list_slice(pd->children_list, start, count);
236 eina_promise_owner_value_set(promise, &ac, (Eina_Promise_Free_Cb)&_accessor_free); 236 eina_promise_owner_value_set(promise, ac, (Eina_Promise_Free_Cb)&eina_accessor_free);
237} 237}
238 238
239static void 239static void