summaryrefslogtreecommitdiff
path: root/src/lib/eldbus
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2016-06-08 19:33:29 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2016-06-09 22:38:54 -0300
commit46843551c0af0b58c67cb2f998ece53a32437748 (patch)
tree246303026b113d9f61130c4e0404d521531c3396 /src/lib/eldbus
parent5a3331618e9cf52122a262cd35ab2aee4642d67c (diff)
eina: Remove value type promises
All values in promises are now considered as by-pointer.
Diffstat (limited to 'src/lib/eldbus')
-rw-r--r--src/lib/eldbus/eldbus_model_arguments.c18
-rw-r--r--src/lib/eldbus/eldbus_model_connection.c15
-rw-r--r--src/lib/eldbus/eldbus_model_object.c15
-rw-r--r--src/lib/eldbus/eldbus_model_proxy.c23
4 files changed, 43 insertions, 28 deletions
diff --git a/src/lib/eldbus/eldbus_model_arguments.c b/src/lib/eldbus/eldbus_model_arguments.c
index 91192c9411..05f3ce9eea 100644
--- a/src/lib/eldbus/eldbus_model_arguments.c
+++ b/src/lib/eldbus/eldbus_model_arguments.c
@@ -121,6 +121,7 @@ _eldbus_model_arguments_efl_model_property_set(Eo *obj EINA_UNUSED,
121 Eina_Promise_Owner *promise) 121 Eina_Promise_Owner *promise)
122{ 122{
123 Eina_Value *prop_value; 123 Eina_Value *prop_value;
124 Eina_Value *promise_value;
124 125
125 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(property, promise, EFL_MODEL_ERROR_INCORRECT_VALUE); 126 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(property, promise, EFL_MODEL_ERROR_INCORRECT_VALUE);
126 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(value, promise, EFL_MODEL_ERROR_INCORRECT_VALUE); 127 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(value, promise, EFL_MODEL_ERROR_INCORRECT_VALUE);
@@ -136,8 +137,10 @@ _eldbus_model_arguments_efl_model_property_set(Eo *obj EINA_UNUSED,
136 137
137 eina_value_flush(prop_value); 138 eina_value_flush(prop_value);
138 eina_value_copy(value, prop_value); 139 eina_value_copy(value, prop_value);
139 eina_value_copy(value, eina_promise_owner_buffer_get(promise)); 140
140 eina_promise_owner_value_set(promise, NULL, (Eina_Promise_Free_Cb)&eina_value_flush); 141 promise_value = eina_value_new(eina_value_type_get(value));
142 eina_value_copy(value, promise_value);
143 eina_promise_owner_value_set(promise, promise_value, (Eina_Promise_Free_Cb)&eina_value_free);
141} 144}
142 145
143static void 146static void
@@ -146,6 +149,7 @@ _eldbus_model_arguments_efl_model_property_get(Eo *obj EINA_UNUSED,
146 const char *property, 149 const char *property,
147 Eina_Promise_Owner *promise) 150 Eina_Promise_Owner *promise)
148{ 151{
152 Eina_Value *promise_value;
149 EINA_SAFETY_ON_NULL_RETURN(promise); 153 EINA_SAFETY_ON_NULL_RETURN(promise);
150 154
151 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(property, promise, EFL_MODEL_ERROR_INCORRECT_VALUE); 155 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(property, promise, EFL_MODEL_ERROR_INCORRECT_VALUE);
@@ -159,8 +163,9 @@ _eldbus_model_arguments_efl_model_property_get(Eo *obj EINA_UNUSED,
159 Eina_Bool ret = _eldbus_model_arguments_is_output_argument(pd, property); 163 Eina_Bool ret = _eldbus_model_arguments_is_output_argument(pd, property);
160 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(ret, promise, EFL_MODEL_ERROR_PERMISSION_DENIED); 164 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(ret, promise, EFL_MODEL_ERROR_PERMISSION_DENIED);
161 165
162 eina_value_copy(value, eina_promise_owner_buffer_get(promise)); 166 promise_value = eina_value_new(eina_value_type_get(value));
163 eina_promise_owner_value_set(promise, NULL, (Eina_Promise_Free_Cb)&eina_value_flush); 167 eina_value_copy(value, promise_value);
168 eina_promise_owner_value_set(promise, promise_value, (Eina_Promise_Free_Cb)&eina_value_free);
164} 169}
165 170
166static Eo * 171static Eo *
@@ -191,8 +196,9 @@ _eldbus_model_arguments_efl_model_children_count_get(Eo *obj EINA_UNUSED,
191 Eldbus_Model_Arguments_Data *pd EINA_UNUSED, 196 Eldbus_Model_Arguments_Data *pd EINA_UNUSED,
192 Eina_Promise_Owner *promise) 197 Eina_Promise_Owner *promise)
193{ 198{
194 unsigned count = 0; 199 unsigned *count = malloc(sizeof(unsigned));
195 eina_promise_owner_value_set(promise, &count, NULL); 200 *count = 0;
201 eina_promise_owner_value_set(promise, count, free);
196} 202}
197 203
198static const char * 204static const char *
diff --git a/src/lib/eldbus/eldbus_model_connection.c b/src/lib/eldbus/eldbus_model_connection.c
index b05d9f7b34..e29eeb5116 100644
--- a/src/lib/eldbus/eldbus_model_connection.c
+++ b/src/lib/eldbus/eldbus_model_connection.c
@@ -114,10 +114,9 @@ _eldbus_model_connection_efl_model_property_get(Eo *obj EINA_UNUSED,
114 pd->unique_name = strdup(unique_name); 114 pd->unique_name = strdup(unique_name);
115 } 115 }
116 116
117 Eina_Value* v = eina_promise_owner_buffer_get(promise); 117 Eina_Value* v = eina_value_new(EINA_VALUE_TYPE_STRING);
118 eina_value_setup(v, EINA_VALUE_TYPE_STRING);
119 eina_value_set(v, pd->unique_name); 118 eina_value_set(v, pd->unique_name);
120 eina_promise_owner_value_set(promise, NULL, (Eina_Promise_Free_Cb)&eina_value_flush); 119 eina_promise_owner_value_set(promise, v, (Eina_Promise_Free_Cb)&eina_value_free);
121} 120}
122 121
123static Eo * 122static Eo *
@@ -179,8 +178,9 @@ _eldbus_model_connection_efl_model_children_count_get(Eo *obj EINA_UNUSED,
179 178
180 if (pd->is_listed) 179 if (pd->is_listed)
181 { 180 {
182 unsigned int c = eina_list_count(pd->children_list); 181 unsigned int *c = calloc(sizeof(unsigned int), 1);
183 eina_promise_owner_value_set(promise, &c, NULL); 182 *c = eina_list_count(pd->children_list);
183 eina_promise_owner_value_set(promise, c, free);
184 return; 184 return;
185 } 185 }
186 186
@@ -346,8 +346,9 @@ _eldbus_model_connection_names_list_cb(void *data,
346 Eina_Promise_Owner *ep; 346 Eina_Promise_Owner *ep;
347 EINA_LIST_FOREACH(pd->count_promises, i, ep) 347 EINA_LIST_FOREACH(pd->count_promises, i, ep)
348 { 348 {
349 unsigned c = eina_list_count(pd->children_list); 349 unsigned *c = calloc(sizeof(unsigned), 1);
350 eina_promise_owner_value_set(ep, &c, NULL); 350 *c = eina_list_count(pd->children_list);
351 eina_promise_owner_value_set(ep, c, free);
351 } 352 }
352 eina_list_free(pd->count_promises); 353 eina_list_free(pd->count_promises);
353} 354}
diff --git a/src/lib/eldbus/eldbus_model_object.c b/src/lib/eldbus/eldbus_model_object.c
index b2ab91e05f..d3cd86a0f6 100644
--- a/src/lib/eldbus/eldbus_model_object.c
+++ b/src/lib/eldbus/eldbus_model_object.c
@@ -149,10 +149,9 @@ _eldbus_model_object_efl_model_property_get(Eo *obj EINA_UNUSED,
149 pd->unique_name = strdup(unique_name); 149 pd->unique_name = strdup(unique_name);
150 } 150 }
151 151
152 Eina_Value* v = eina_promise_owner_buffer_get(promise); 152 Eina_Value* v = eina_value_new(EINA_VALUE_TYPE_STRING);
153 eina_value_setup(v, EINA_VALUE_TYPE_STRING);
154 eina_value_set(v, pd->unique_name); 153 eina_value_set(v, pd->unique_name);
155 eina_promise_owner_value_set(promise, NULL, (Eina_Promise_Free_Cb)&eina_value_flush); 154 eina_promise_owner_value_set(promise, v, (Eina_Promise_Free_Cb)&eina_value_free);
156} 155}
157 156
158static Eo * 157static Eo *
@@ -208,8 +207,9 @@ _eldbus_model_object_efl_model_children_count_get(Eo *obj EINA_UNUSED,
208 207
209 if (pd->is_listed) 208 if (pd->is_listed)
210 { 209 {
211 unsigned int c = eina_list_count(pd->children_list); 210 unsigned int *c = calloc(sizeof(unsigned int), 1);
212 eina_promise_owner_value_set(promise, &c, NULL); 211 *c = eina_list_count(pd->children_list);
212 eina_promise_owner_value_set(promise, c, free);
213 return; 213 return;
214 } 214 }
215 215
@@ -438,8 +438,9 @@ _eldbus_model_object_introspect_cb(void *data,
438 Eina_Promise_Owner *ep; 438 Eina_Promise_Owner *ep;
439 EINA_LIST_FOREACH(pd->count_promises, i, ep) 439 EINA_LIST_FOREACH(pd->count_promises, i, ep)
440 { 440 {
441 unsigned c = eina_list_count(pd->children_list); 441 unsigned *c = calloc(sizeof(unsigned), 1);
442 eina_promise_owner_value_set(ep, &c, NULL); 442 *c = eina_list_count(pd->children_list);
443 eina_promise_owner_value_set(ep, c, free);
443 } 444 }
444 eina_list_free(pd->count_promises); 445 eina_list_free(pd->count_promises);
445 446
diff --git a/src/lib/eldbus/eldbus_model_proxy.c b/src/lib/eldbus/eldbus_model_proxy.c
index d6b104766f..1c75a8f7a1 100644
--- a/src/lib/eldbus/eldbus_model_proxy.c
+++ b/src/lib/eldbus/eldbus_model_proxy.c
@@ -163,6 +163,7 @@ _eldbus_model_proxy_efl_model_property_get(Eo *obj EINA_UNUSED,
163 Eina_Promise_Owner *promise) 163 Eina_Promise_Owner *promise)
164{ 164{
165 Eina_Bool ret; 165 Eina_Bool ret;
166 Eina_Value *promise_value;
166 EINA_SAFETY_ON_NULL_RETURN(promise); 167 EINA_SAFETY_ON_NULL_RETURN(promise);
167 168
168 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(property, promise, EFL_MODEL_ERROR_INCORRECT_VALUE); 169 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(property, promise, EFL_MODEL_ERROR_INCORRECT_VALUE);
@@ -197,8 +198,9 @@ _eldbus_model_proxy_efl_model_property_get(Eo *obj EINA_UNUSED,
197 ret = _eldbus_model_proxy_is_property_writeable(pd, property); 198 ret = _eldbus_model_proxy_is_property_writeable(pd, property);
198 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(ret, promise, EFL_MODEL_ERROR_READ_ONLY); 199 ELDBUS_MODEL_ON_ERROR_EXIT_PROMISE_SET(ret, promise, EFL_MODEL_ERROR_READ_ONLY);
199 200
200 eina_value_copy(value, eina_promise_owner_buffer_get(promise)); 201 promise_value = eina_value_new(eina_value_type_get(value));
201 eina_promise_owner_value_set(promise, NULL, (Eina_Promise_Free_Cb)&eina_value_flush); 202 eina_value_copy(value, promise_value);
203 eina_promise_owner_value_set(promise, promise_value, (Eina_Promise_Free_Cb)&eina_value_free);
202} 204}
203 205
204static Eo * 206static Eo *
@@ -251,8 +253,9 @@ _eldbus_model_proxy_efl_model_children_count_get(Eo *obj EINA_UNUSED,
251 pd->is_listed = EINA_TRUE; 253 pd->is_listed = EINA_TRUE;
252 } 254 }
253 255
254 unsigned int c = eina_list_count(pd->children_list); 256 unsigned int *c = calloc(sizeof(unsigned int), 1);
255 eina_promise_owner_value_set(promise, &c, NULL); 257 *c = eina_list_count(pd->children_list);
258 eina_promise_owner_value_set(promise, c, free);
256} 259}
257 260
258static void 261static void
@@ -554,6 +557,7 @@ _eldbus_model_proxy_property_get_all_cb(void *data,
554 const Eldbus_Message *msg, 557 const Eldbus_Message *msg,
555 Eldbus_Pending *pending) 558 Eldbus_Pending *pending)
556{ 559{
560 Eina_Value *promise_value;
557 Eldbus_Model_Proxy_Data *pd = (Eldbus_Model_Proxy_Data*)data; 561 Eldbus_Model_Proxy_Data *pd = (Eldbus_Model_Proxy_Data*)data;
558 562
559 pd->pending_list = eina_list_remove(pd->pending_list, pending); 563 pd->pending_list = eina_list_remove(pd->pending_list, pending);
@@ -592,8 +596,9 @@ _eldbus_model_proxy_property_get_all_cb(void *data,
592 596
593 free(p->property); 597 free(p->property);
594 598
595 eina_value_copy(value, eina_promise_owner_buffer_get(p->promise)); 599 promise_value = eina_value_new(eina_value_type_get(value));
596 eina_promise_owner_value_set(p->promise, NULL, (Eina_Promise_Free_Cb)&eina_value_flush); 600 eina_value_copy(value, promise_value);
601 eina_promise_owner_value_set(p->promise, promise_value, (Eina_Promise_Free_Cb)&eina_value_free);
597 } 602 }
598 eina_list_free(pd->promise_list); 603 eina_list_free(pd->promise_list);
599 604
@@ -651,6 +656,7 @@ _eldbus_model_proxy_property_set_cb(void *data,
651 Eldbus_Model_Proxy_Data *pd = property_set_data->pd; 656 Eldbus_Model_Proxy_Data *pd = property_set_data->pd;
652 const char *error_name, *error_text; 657 const char *error_name, *error_text;
653 Eina_Value *prop_value; 658 Eina_Value *prop_value;
659 Eina_Value *promise_value;
654 660
655 pd->pending_list = eina_list_remove(pd->pending_list, pending); 661 pd->pending_list = eina_list_remove(pd->pending_list, pending);
656 662
@@ -675,8 +681,9 @@ _eldbus_model_proxy_property_set_cb(void *data,
675 efl_model_property_changed_notify(pd->obj, property_set_data->property); 681 efl_model_property_changed_notify(pd->obj, property_set_data->property);
676 682
677 } 683 }
678 eina_value_copy(prop_value, eina_promise_owner_buffer_get(property_set_data->promise)); 684 promise_value = eina_value_new(eina_value_type_get(prop_value));
679 eina_promise_owner_value_set(property_set_data->promise, NULL, (Eina_Promise_Free_Cb)&eina_value_flush); 685 eina_value_copy(prop_value, promise_value);
686 eina_promise_owner_value_set(property_set_data->promise, promise_value, (Eina_Promise_Free_Cb)&eina_value_free);
680 } 687 }
681 else 688 else
682 { 689 {