summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2018-11-23 16:25:19 +0000
committerCedric BAIL <cedric@osg.samsung.com>2018-11-23 10:13:58 -0800
commitd4d44d76f3efef4d61edb4cce7152284915a12d2 (patch)
tree502779c9047c6a8e02c8466f81ddc8616887fa50 /src
parentaac7d099a17d69f5989481f8999a43d4173005bd (diff)
downloadefl-d4d44d76f3efef4d61edb4cce7152284915a12d2.tar.gz
efl: make Efl.Model.properties_get return an Iterator<string>.
Reviewed-by: Vitor Sousa da Silva <vitorsousa@expertisesolutions.com.br> Differential Revision: https://phab.enlightenment.org/D7289
Diffstat (limited to 'src')
-rw-r--r--src/examples/eldbus/dbusmodel.c13
-rw-r--r--src/lib/ecore/efl_model_composite.c2
-rw-r--r--src/lib/ecore/efl_model_composite_boolean.c19
-rw-r--r--src/lib/ecore/efl_model_container.c14
-rw-r--r--src/lib/ecore/efl_model_container_item.c2
-rw-r--r--src/lib/ecore/efl_model_item.c8
-rw-r--r--src/lib/efl/interfaces/efl_model.eo2
-rw-r--r--src/lib/eio/eio_model.c11
-rw-r--r--src/lib/eldbus/eldbus_model.c9
-rw-r--r--src/lib/eldbus/eldbus_model_arguments.c71
-rw-r--r--src/lib/eldbus/eldbus_model_arguments_private.h5
-rw-r--r--src/lib/eldbus/eldbus_model_method.c7
-rw-r--r--src/lib/eldbus/eldbus_model_proxy.c15
-rw-r--r--src/lib/elementary/efl_ui_list_view.c14
-rw-r--r--src/tests/eldbus/eldbus_test_eldbus_model_connection.c10
-rw-r--r--src/tests/eldbus/eldbus_test_eldbus_model_method.c9
-rw-r--r--src/tests/eldbus/eldbus_test_eldbus_model_object.c9
-rw-r--r--src/tests/eldbus/eldbus_test_eldbus_model_proxy.c3
-rw-r--r--src/tests/eldbus/eldbus_test_eldbus_model_signal.c9
-rw-r--r--src/tests/eldbus/eldbus_test_fake_server_eldbus_model_proxy.c9
20 files changed, 104 insertions, 137 deletions
diff --git a/src/examples/eldbus/dbusmodel.c b/src/examples/eldbus/dbusmodel.c
index 10150c40f2..cc09d79ae3 100644
--- a/src/examples/eldbus/dbusmodel.c
+++ b/src/examples/eldbus/dbusmodel.c
@@ -64,17 +64,16 @@ EFL_CALLBACKS_ARRAY_DEFINE(child_cbs,
static void
process(Eo *child, unsigned int index)
{
- Eina_Array *properties = efl_model_properties_get(child);
+ Eina_Iterator *properties = efl_model_properties_get(child);
const char *property;
- Eina_Array_Iterator it;
Eina_Strbuf *buf;
- unsigned int i;
+ Eina_Bool noproperties = EINA_TRUE;
buf = eina_strbuf_new();
const char *name = eldbus_model_proxy_name_get(child);
- EINA_ARRAY_ITER_NEXT(properties, i, property, it)
+ EINA_ITERATOR_FOREACH(properties, property)
{
Eina_Value *v = efl_model_property_get(child, property);
char *str;
@@ -90,16 +89,18 @@ process(Eo *child, unsigned int index)
free(str);
eina_value_free(v);
+
+ noproperties = EINA_FALSE;
}
+ eina_iterator_free(properties);
- if (eina_array_count(properties) <= 0)
+ if (noproperties)
eina_strbuf_append_printf(buf, " %2d: %s (no properties yet)\n", index, name);
else
eina_strbuf_prepend_printf(buf, " -> %s\n Properties:\n", name);
printf("%s", eina_strbuf_string_get(buf));
- eina_array_free(properties);
eina_strbuf_free(buf);
efl_ref(child);
diff --git a/src/lib/ecore/efl_model_composite.c b/src/lib/ecore/efl_model_composite.c
index 90cd8adc84..dfb3019cbd 100644
--- a/src/lib/ecore/efl_model_composite.c
+++ b/src/lib/ecore/efl_model_composite.c
@@ -69,7 +69,7 @@ _efl_model_composite_efl_model_property_get(const Eo *obj EINA_UNUSED, Efl_Model
return efl_model_property_get(pd->source, property);
}
-static Eina_Array *
+static Eina_Iterator *
_efl_model_composite_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Model_Composite_Data *pd)
{
return efl_model_properties_get(pd->source);
diff --git a/src/lib/ecore/efl_model_composite_boolean.c b/src/lib/ecore/efl_model_composite_boolean.c
index 98dbbe5bb1..ef9ec433a5 100644
--- a/src/lib/ecore/efl_model_composite_boolean.c
+++ b/src/lib/ecore/efl_model_composite_boolean.c
@@ -67,23 +67,20 @@ _efl_model_composite_boolean_children_efl_object_finalize(Eo *obj,
return obj;
}
-static Eina_Array *
+static Eina_Iterator *
_efl_model_composite_boolean_children_efl_model_properties_get(const Eo *obj,
Efl_Model_Composite_Boolean_Children_Data *pd)
{
- Eina_Iterator *it;
- Eina_Stringshare *s;
- Eina_Array *r;
+ Eina_Iterator *its;
+ Eina_Iterator *itr;
- r = efl_model_properties_get(efl_super(obj, EFL_MODEL_COMPOSITE_BOOLEAN_CHILDREN_CLASS));
- if (!r) r = eina_array_new(1);
+ its = efl_model_properties_get(efl_super(obj, EFL_MODEL_COMPOSITE_BOOLEAN_CHILDREN_CLASS));
+ itr = eina_hash_iterator_key_new(pd->parent->values);
- it = eina_hash_iterator_key_new(pd->parent->values);
- EINA_ITERATOR_FOREACH(it, s)
- eina_array_push(r, s);
- eina_array_push(r, "child.index");
+ if (!its) return itr;
+ if (!itr) return its;
- return r;
+ return eina_multi_iterator_new(its, itr);
}
static Eina_Value *
diff --git a/src/lib/ecore/efl_model_container.c b/src/lib/ecore/efl_model_container.c
index 0832a2f0dc..5449ae4307 100644
--- a/src/lib/ecore/efl_model_container.c
+++ b/src/lib/ecore/efl_model_container.c
@@ -225,20 +225,10 @@ _efl_model_container_child_property_add(Eo *obj,
return EINA_FALSE;
}
-static Eina_Array *
+static Eina_Iterator *
_efl_model_container_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Model_Container_Data *sd)
{
- Eina_Iterator *it;
- Eina_Array *r;
- Eina_Stringshare *s;
-
- r = eina_array_new(1);
- it = eina_hash_iterator_key_new(sd->properties);
- EINA_ITERATOR_FOREACH(it, s)
- eina_array_push(r, eina_stringshare_ref(s));
- eina_iterator_free(it);
-
- return r;
+ return eina_hash_iterator_key_new(sd->properties);
}
static Eina_Future *
diff --git a/src/lib/ecore/efl_model_container_item.c b/src/lib/ecore/efl_model_container_item.c
index b87558a3b3..c3fa8d0c90 100644
--- a/src/lib/ecore/efl_model_container_item.c
+++ b/src/lib/ecore/efl_model_container_item.c
@@ -25,7 +25,7 @@ _efl_model_container_item_efl_object_invalidate(Eo *obj, Efl_Model_Container_Ite
sd->index = 0;
}
-static Eina_Array *
+static Eina_Iterator *
_efl_model_container_item_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Model_Container_Item_Data *sd)
{
// FIXME: Not to sure here, shouldn't we extend a child of the parent actually ?
diff --git a/src/lib/ecore/efl_model_item.c b/src/lib/ecore/efl_model_item.c
index e5058c10ff..104125a705 100644
--- a/src/lib/ecore/efl_model_item.c
+++ b/src/lib/ecore/efl_model_item.c
@@ -13,7 +13,6 @@ typedef struct _Efl_Model_Item_Data Efl_Model_Item_Data;
struct _Efl_Model_Item_Data
{
Eina_Hash *properties;
- Eina_Array *defined_properties;
Eina_List *childrens;
};
@@ -38,7 +37,6 @@ _efl_model_item_efl_object_constructor(Eo *obj, Efl_Model_Item_Data *sd)
return NULL;
sd->properties = eina_hash_stringshared_new(_item_value_free_cb);
- sd->defined_properties = eina_array_new(8);
return obj;
}
@@ -57,15 +55,13 @@ _efl_model_item_efl_object_destructor(Eo *obj, Efl_Model_Item_Data *sd)
eina_hash_foreach(sd->properties, _stringshared_keys_free, NULL);
eina_hash_free(sd->properties);
- eina_array_free(sd->defined_properties);
-
efl_destructor(efl_super(obj, MY_CLASS));
}
-static Eina_Array *
+static Eina_Iterator *
_efl_model_item_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Model_Item_Data *pd)
{
- return pd->defined_properties;
+ return eina_hash_iterator_key_new(pd->properties);
}
static Eina_Future *
diff --git a/src/lib/efl/interfaces/efl_model.eo b/src/lib/efl/interfaces/efl_model.eo
index 88260db317..ffe8bf4430 100644
--- a/src/lib/efl/interfaces/efl_model.eo
+++ b/src/lib/efl/interfaces/efl_model.eo
@@ -33,7 +33,7 @@ interface Efl.Model ()
]]
}
values {
- properties: array<string>; [[Array of current properties]]
+ properties: iterator<string> @owned; [[Array of current properties]]
}
}
@property property {
diff --git a/src/lib/eio/eio_model.c b/src/lib/eio/eio_model.c
index 62e52f46dd..ee8296a03b 100644
--- a/src/lib/eio/eio_model.c
+++ b/src/lib/eio/eio_model.c
@@ -631,18 +631,11 @@ static struct {
/**
* Interfaces impl.
*/
-static Eina_Array *
+static Eina_Iterator *
_eio_model_efl_model_properties_get(const Eo *obj EINA_UNUSED,
Eio_Model_Data *pd EINA_UNUSED)
{
- Eina_Array *r;
- unsigned int i;
-
- r = eina_array_new(4);
- for (i = 0; i < EINA_C_ARRAY_LENGTH(properties); ++i)
- eina_array_push(r, properties[i].name);
-
- return r;
+ return EINA_C_ARRAY_ITERATOR_NEW(properties);
}
static Eina_Value *
diff --git a/src/lib/eldbus/eldbus_model.c b/src/lib/eldbus/eldbus_model.c
index 28faa0fb24..3a2115ead0 100644
--- a/src/lib/eldbus/eldbus_model.c
+++ b/src/lib/eldbus/eldbus_model.c
@@ -152,16 +152,13 @@ _eldbus_model_efl_model_property_get(const Eo *obj,
return eina_value_error_new(EFL_MODEL_ERROR_NOT_FOUND);
}
-static Eina_Array *
+static Eina_Iterator *
_eldbus_model_efl_model_properties_get(const Eo *obj EINA_UNUSED,
Eldbus_Model_Data *pd EINA_UNUSED)
{
- Eina_Array *r;
+ char *unique[] = { UNIQUE_NAME_PROPERTY };
- r = eina_array_new(1);
- eina_array_push(r, eina_stringshare_add(UNIQUE_NAME_PROPERTY));
-
- return r;
+ return EINA_C_ARRAY_ITERATOR_NEW(unique);
}
static Efl_Object *
diff --git a/src/lib/eldbus/eldbus_model_arguments.c b/src/lib/eldbus/eldbus_model_arguments.c
index 1d22903668..4c609300e8 100644
--- a/src/lib/eldbus/eldbus_model_arguments.c
+++ b/src/lib/eldbus/eldbus_model_arguments.c
@@ -12,8 +12,6 @@
#define MY_CLASS ELDBUS_MODEL_ARGUMENTS_CLASS
#define MY_CLASS_NAME "Eldbus_Model_Arguments"
-#define ARGUMENT_FORMAT "arg%u"
-
static void _eldbus_model_arguments_properties_load(Eldbus_Model_Arguments_Data *);
static void _eldbus_model_arguments_unload(Eldbus_Model_Arguments_Data *);
static Eina_Bool _eldbus_model_arguments_is_input_argument(Eldbus_Model_Arguments_Data *, const char *);
@@ -31,8 +29,8 @@ static Efl_Object*
_eldbus_model_arguments_efl_object_constructor(Eo *obj, Eldbus_Model_Arguments_Data *pd)
{
pd->obj = obj;
- pd->properties_array = NULL;
- pd->properties_hash = eina_hash_string_superfast_new(EINA_FREE_CB(_eldbus_model_arguments_hash_free));
+ // We do keep strings here as some of our API are looking for arg%u as a key instead of just indexes.
+ pd->properties = eina_hash_string_superfast_new(EINA_FREE_CB(_eldbus_model_arguments_hash_free));
pd->pending_list = NULL;
pd->proxy = NULL;
pd->arguments = NULL;
@@ -72,7 +70,7 @@ _eldbus_model_arguments_efl_object_destructor(Eo *obj, Eldbus_Model_Arguments_Da
{
_eldbus_model_arguments_unload(pd);
- eina_hash_free(pd->properties_hash);
+ eina_hash_free(pd->properties);
eina_stringshare_del(pd->name);
eldbus_proxy_unref(pd->proxy);
@@ -80,14 +78,14 @@ _eldbus_model_arguments_efl_object_destructor(Eo *obj, Eldbus_Model_Arguments_Da
efl_destructor(efl_super(obj, MY_CLASS));
}
-static Eina_Array *
+static Eina_Iterator *
_eldbus_model_arguments_efl_model_properties_get(const Eo *obj EINA_UNUSED,
Eldbus_Model_Arguments_Data *pd)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(pd, NULL);
_eldbus_model_arguments_properties_load(pd);
- return pd->properties_array;
+ return eina_hash_iterator_key_new(pd->properties);
}
static void
@@ -96,30 +94,25 @@ _eldbus_model_arguments_properties_load(Eldbus_Model_Arguments_Data *pd)
unsigned int arguments_count;
unsigned int i;
- if (pd->properties_array)
- return;
+ if (eina_hash_population(pd->properties) > 0)
+ return ;
arguments_count = eina_list_count(pd->arguments);
- pd->properties_array = eina_array_new(arguments_count);
- EINA_SAFETY_ON_NULL_RETURN(pd->properties_array);
-
for (i = 0; i < arguments_count; ++i)
{
Eldbus_Introspection_Argument *arg;
const Eina_Value_Type *type;
- Eina_Stringshare *name;
+ Eina_Slstr *name;
Eina_Value *value;
- name = eina_stringshare_printf(ARGUMENT_FORMAT, i);
+ name = eina_slstr_printf(ARGUMENT_FORMAT, i);
if (!name) continue;
- eina_array_push(pd->properties_array, name);
-
arg = eina_list_nth(pd->arguments, i);
type = _dbus_type_to_eina_value_type(arg->type[0]);
value = eina_value_new(type);
- eina_hash_add(pd->properties_hash, name, value);
+ eina_hash_add(pd->properties, name, value);
}
}
@@ -144,7 +137,7 @@ _eldbus_model_arguments_efl_model_property_set(Eo *obj,
if (!ret) goto on_error;
err = EFL_MODEL_ERROR_NOT_FOUND;
- prop_value = eina_hash_find(pd->properties_hash, property);
+ prop_value = eina_hash_find(pd->properties, property);
if (!prop_value) goto on_error;
eina_value_flush(prop_value);
@@ -168,7 +161,7 @@ _eldbus_model_arguments_efl_model_property_get(const Eo *obj, Eldbus_Model_Argum
_eldbus_model_arguments_properties_load(pd);
- value = eina_hash_find(pd->properties_hash, property);
+ value = eina_hash_find(pd->properties, property);
if (!value) return eina_value_error_new(EFL_MODEL_ERROR_NOT_FOUND);
ret = _eldbus_model_arguments_is_output_argument(pd, property);
@@ -193,19 +186,7 @@ _eldbus_model_arguments_unload(Eldbus_Model_Arguments_Data *pd)
EINA_LIST_FREE(pd->pending_list, pending)
eldbus_pending_cancel(pending);
- if (pd->properties_array)
- {
- Eina_Stringshare *property;
- Eina_Array_Iterator it;
- unsigned int i;
-
- EINA_ARRAY_ITER_NEXT(pd->properties_array, i, property, it)
- eina_stringshare_del(property);
- eina_array_free(pd->properties_array);
- pd->properties_array = NULL;
- }
-
- eina_hash_free_buckets(pd->properties_hash);
+ eina_hash_free_buckets(pd->properties);
}
Eina_Bool
@@ -219,6 +200,7 @@ eldbus_model_arguments_process_arguments(Eldbus_Model_Arguments_Data *pd,
Eina_Value *value_struct;
Eina_Array *changed_properties;
unsigned int i = 0;
+ Eina_Stringshare *property;
Eina_Bool result = EINA_FALSE;
_eldbus_model_arguments_properties_load(pd);
@@ -244,16 +226,14 @@ eldbus_model_arguments_process_arguments(Eldbus_Model_Arguments_Data *pd,
{
if (ELDBUS_INTROSPECTION_ARGUMENT_DIRECTION_IN != argument->direction)
{
- Eina_Stringshare *property;
Eina_Bool ret;
- property = eina_array_data_get(pd->properties_array, i);
- EINA_SAFETY_ON_NULL_GOTO(property, on_error);
+ property = eina_stringshare_printf(ARGUMENT_FORMAT, i);
- ret = _eldbus_model_arguments_property_set(pd, value_struct, property);
+ ret = eina_array_push(changed_properties, property);
EINA_SAFETY_ON_FALSE_GOTO(ret, on_error);
- ret = eina_array_push(changed_properties, property);
+ ret = _eldbus_model_arguments_property_set(pd, value_struct, property);
EINA_SAFETY_ON_FALSE_GOTO(ret, on_error);
}
@@ -269,6 +249,8 @@ eldbus_model_arguments_process_arguments(Eldbus_Model_Arguments_Data *pd,
result = EINA_TRUE;
on_error:
+ while (property = eina_array_pop(changed_properties))
+ eina_stringshare_del(property);
eina_array_free(changed_properties);
eina_value_free(value_struct);
@@ -286,7 +268,7 @@ _eldbus_model_arguments_property_set(Eldbus_Model_Arguments_Data *pd,
_eldbus_model_arguments_properties_load(pd);
- prop_value = eina_hash_find(pd->properties_hash, property);
+ prop_value = eina_hash_find(pd->properties, property);
EINA_SAFETY_ON_NULL_RETURN_VAL(prop_value, EINA_FALSE);
ret = eina_value_struct_value_get(value_struct, "arg0", &value);
@@ -311,7 +293,7 @@ _eldbus_model_arguments_is(Eldbus_Model_Arguments_Data *pd,
_eldbus_model_arguments_properties_load(pd);
i = _eldbus_model_arguments_argument_index_get(pd, argument);
- if (i >= eina_array_count(pd->properties_array))
+ if (i >= eina_hash_population(pd->properties))
{
WRN("Argument not found: %s", argument);
return false;
@@ -342,15 +324,10 @@ _eldbus_model_arguments_argument_index_get(Eldbus_Model_Arguments_Data *pd, cons
Eina_Stringshare *name;
Eina_Array_Iterator it;
unsigned int i = 0;
- _eldbus_model_arguments_properties_load(pd);
-
- EINA_ARRAY_ITER_NEXT(pd->properties_array, i, name, it)
- {
- if (strcmp(name, argument) == 0)
- return i;
- }
- return ++i;
+ if (sscanf(argument, ARGUMENT_FORMAT, &i) > 0)
+ return i;
+ return eina_hash_population(pd->properties);
}
#include "eldbus_model_arguments.eo.c"
diff --git a/src/lib/eldbus/eldbus_model_arguments_private.h b/src/lib/eldbus/eldbus_model_arguments_private.h
index 06aa1aed9c..83d55dd643 100644
--- a/src/lib/eldbus/eldbus_model_arguments_private.h
+++ b/src/lib/eldbus/eldbus_model_arguments_private.h
@@ -14,8 +14,7 @@ struct _Eldbus_Model_Arguments_Data
{
Eo *obj;
Eldbus_Proxy *proxy;
- Eina_Array *properties_array;
- Eina_Hash *properties_hash;
+ Eina_Hash *properties;
Eina_Stringshare *name;
Eina_List *pending_list;
const Eina_List *arguments;
@@ -24,4 +23,6 @@ struct _Eldbus_Model_Arguments_Data
Eina_Bool eldbus_model_arguments_process_arguments(Eldbus_Model_Arguments_Data *, const Eldbus_Message *, Eldbus_Pending *);
+#define ARGUMENT_FORMAT "arg%u"
+
#endif
diff --git a/src/lib/eldbus/eldbus_model_method.c b/src/lib/eldbus/eldbus_model_method.c
index 8e7e87bf27..dbdbdde831 100644
--- a/src/lib/eldbus/eldbus_model_method.c
+++ b/src/lib/eldbus/eldbus_model_method.c
@@ -69,7 +69,7 @@ _eldbus_model_method_call(Eo *obj EINA_UNUSED, Eldbus_Model_Method_Data *pd EINA
EINA_LIST_FOREACH(data->arguments, it, argument)
{
- Eina_Stringshare *name;
+ Eina_Slstr *name;
const Eina_Value *value;
const char *signature;
Eina_Bool ret;
@@ -77,11 +77,10 @@ _eldbus_model_method_call(Eo *obj EINA_UNUSED, Eldbus_Model_Method_Data *pd EINA
if (ELDBUS_INTROSPECTION_ARGUMENT_DIRECTION_IN != argument->direction)
continue;
- name = eina_array_data_get(data->properties_array, i);
- if (!name) continue;
+ name = eina_slstr_printf(ARGUMENT_FORMAT, i);
EINA_SAFETY_ON_NULL_GOTO(name, on_error);
- value = eina_hash_find(data->properties_hash, name);
+ value = eina_hash_find(data->properties, name);
EINA_SAFETY_ON_NULL_GOTO(value, on_error);
signature = argument->type;
diff --git a/src/lib/eldbus/eldbus_model_proxy.c b/src/lib/eldbus/eldbus_model_proxy.c
index c1ab3b2565..a159ecd16b 100644
--- a/src/lib/eldbus/eldbus_model_proxy.c
+++ b/src/lib/eldbus/eldbus_model_proxy.c
@@ -190,22 +190,11 @@ _eldbus_model_proxy_efl_object_destructor(Eo *obj, Eldbus_Model_Proxy_Data *pd)
efl_destructor(efl_super(obj, MY_CLASS));
}
-static Eina_Array *
+static Eina_Iterator *
_eldbus_model_proxy_efl_model_properties_get(const Eo *obj EINA_UNUSED,
Eldbus_Model_Proxy_Data *pd)
{
- Eina_Iterator *it;
- Eina_Array *r;
- Eina_Stringshare *property;
-
- r = eina_array_new(4);
-
- it = eina_hash_iterator_key_new(pd->properties);
- EINA_ITERATOR_FOREACH(it, property)
- eina_array_push(r, property);
- eina_iterator_free(it);
-
- return r;
+ return eina_hash_iterator_key_new(pd->properties);
}
#define PROPERTY_EXIST 1
diff --git a/src/lib/elementary/efl_ui_list_view.c b/src/lib/elementary/efl_ui_list_view.c
index e76ce05067..e15081f4d5 100644
--- a/src/lib/elementary/efl_ui_list_view.c
+++ b/src/lib/elementary/efl_ui_list_view.c
@@ -141,25 +141,25 @@ _efl_ui_list_view_efl_ui_scrollable_interactive_viewport_geometry_get(const Eo *
static Eina_Bool
_efl_model_properties_has(Efl_Model *model, Eina_Stringshare *propfind)
{
- const Eina_Array *properties;
- Eina_Array_Iterator iter_prop;
- Eina_Stringshare *property;
+ Eina_Iterator *properties;
+ const char *property;
Eina_Bool ret = EINA_FALSE;
- unsigned i = 0;
EINA_SAFETY_ON_NULL_RETURN_VAL(model, EINA_FALSE);
EINA_SAFETY_ON_NULL_RETURN_VAL(propfind, EINA_FALSE);
properties = efl_model_properties_get(model);
-
- EINA_ARRAY_ITER_NEXT(properties, i, property, iter_prop)
+ EINA_ITERATOR_FOREACH(properties, property)
{
- if (property == propfind)
+ if (property == propfind ||
+ !strcmp(property, propfind))
{
ret = EINA_TRUE;
break;
}
}
+ eina_iterator_free(properties);
+
return ret;
}
diff --git a/src/tests/eldbus/eldbus_test_eldbus_model_connection.c b/src/tests/eldbus/eldbus_test_eldbus_model_connection.c
index aa3e710516..4e57c75d43 100644
--- a/src/tests/eldbus/eldbus_test_eldbus_model_connection.c
+++ b/src/tests/eldbus/eldbus_test_eldbus_model_connection.c
@@ -29,12 +29,18 @@ _teardown(void)
EFL_START_TEST(properties_get)
{
- const Eina_Array *properties = NULL;
+ Eina_Iterator *properties = NULL;
properties = efl_model_properties_get(connection);
ck_assert_ptr_ne(NULL, properties);
const unsigned int expected_properties_count = 1;
- unsigned int actual_properties_count = eina_array_count(properties);
+ unsigned int actual_properties_count = 0;
+ const char *prop;
+
+ EINA_ITERATOR_FOREACH(properties, prop)
+ actual_properties_count++;
+ eina_iterator_free(properties);
+
ck_assert_int_eq(expected_properties_count, actual_properties_count);
}
EFL_END_TEST
diff --git a/src/tests/eldbus/eldbus_test_eldbus_model_method.c b/src/tests/eldbus/eldbus_test_eldbus_model_method.c
index f252fbca7d..1ac32f108e 100644
--- a/src/tests/eldbus/eldbus_test_eldbus_model_method.c
+++ b/src/tests/eldbus/eldbus_test_eldbus_model_method.c
@@ -52,12 +52,17 @@ _teardown(void)
EFL_START_TEST(properties_get)
{
- const Eina_Array *properties = NULL;
+ Eina_Iterator *properties = NULL;
properties = efl_model_properties_get(method);
ck_assert_ptr_ne(NULL, properties);
const unsigned int expected_properties_count = 3; // a, b and result arguments of 'sum' method
- const unsigned int actual_properties_count = eina_array_count(properties);
+ unsigned int actual_properties_count = 0;
+ const char *prop;
+
+ EINA_ITERATOR_FOREACH(properties, prop)
+ actual_properties_count++;
+ eina_iterator_free(properties);
ck_assert_int_eq(expected_properties_count, actual_properties_count);
}
EFL_END_TEST
diff --git a/src/tests/eldbus/eldbus_test_eldbus_model_object.c b/src/tests/eldbus/eldbus_test_eldbus_model_object.c
index 7959a2eb66..e7539eb265 100644
--- a/src/tests/eldbus/eldbus_test_eldbus_model_object.c
+++ b/src/tests/eldbus/eldbus_test_eldbus_model_object.c
@@ -29,12 +29,17 @@ _teardown(void)
EFL_START_TEST(properties_get)
{
- const Eina_Array *properties = NULL;
+ Eina_Iterator *properties = NULL;
properties = efl_model_properties_get(object);
ck_assert_ptr_ne(NULL, properties);
const unsigned int expected_properties_count = 1;
- unsigned int actual_properties_count = eina_array_count(properties);
+ unsigned int actual_properties_count = 0;
+ const char *prop;
+
+ EINA_ITERATOR_FOREACH(properties, prop)
+ actual_properties_count++;
+ eina_iterator_free(properties);
ck_assert_int_eq(expected_properties_count, actual_properties_count);
}
EFL_END_TEST
diff --git a/src/tests/eldbus/eldbus_test_eldbus_model_proxy.c b/src/tests/eldbus/eldbus_test_eldbus_model_proxy.c
index d9665142a2..dabe81fca8 100644
--- a/src/tests/eldbus/eldbus_test_eldbus_model_proxy.c
+++ b/src/tests/eldbus/eldbus_test_eldbus_model_proxy.c
@@ -54,7 +54,7 @@ _teardown(void)
EFL_START_TEST(properties_get)
{
- const Eina_Array *properties = NULL;
+ Eina_Iterator *properties = NULL;
// ELDBUS_FDO_INTERFACE have no properties
properties = efl_model_properties_get(dbus_proxy);
ck_assert_ptr_ne(NULL, properties);
@@ -63,6 +63,7 @@ EFL_START_TEST(properties_get)
// due to an EFL change, but a change in the DBus interface:
// properties contains 2 properties, "Interfaces" and "Features".
//ck_assert_int_eq(0, eina_array_count(properties));
+ eina_iterator_free(properties);
}
EFL_END_TEST
diff --git a/src/tests/eldbus/eldbus_test_eldbus_model_signal.c b/src/tests/eldbus/eldbus_test_eldbus_model_signal.c
index f896792bf6..7651e02687 100644
--- a/src/tests/eldbus/eldbus_test_eldbus_model_signal.c
+++ b/src/tests/eldbus/eldbus_test_eldbus_model_signal.c
@@ -51,12 +51,17 @@ _teardown(void)
EFL_START_TEST(properties_get)
{
- const Eina_Array *properties = NULL;
+ Eina_Iterator *properties = NULL;
properties = efl_model_properties_get(pong_signal);
ck_assert_ptr_ne(NULL, properties);
const unsigned int expected_properties_count = 1; // 'response' only
- const unsigned int actual_properties_count = eina_array_count(properties);
+ unsigned int actual_properties_count = 0;
+ const char *prop;
+
+ EINA_ITERATOR_FOREACH(properties, prop)
+ actual_properties_count += 1;
+ eina_iterator_free(properties);
ck_assert_int_eq(expected_properties_count, actual_properties_count);
}
EFL_END_TEST
diff --git a/src/tests/eldbus/eldbus_test_fake_server_eldbus_model_proxy.c b/src/tests/eldbus/eldbus_test_fake_server_eldbus_model_proxy.c
index 81d35df609..69cf8bafc9 100644
--- a/src/tests/eldbus/eldbus_test_fake_server_eldbus_model_proxy.c
+++ b/src/tests/eldbus/eldbus_test_fake_server_eldbus_model_proxy.c
@@ -52,12 +52,17 @@ _teardown(void)
EFL_START_TEST(properties_get)
{
- const Eina_Array *properties = efl_model_properties_get(fake_server_proxy);
+ Eina_Iterator *properties = efl_model_properties_get(fake_server_proxy);
ck_assert_ptr_ne(NULL, properties);
// FAKE_SERVER_READONLY_PROPERTY, FAKE_SERVER_WRITEONLY_PROPERTY and FAKE_SERVER_READWRITE_PROPERTY properties
const unsigned int expected_properties_count = 3;
- const unsigned int actual_properties_count = eina_array_count(properties);
+ unsigned int actual_properties_count = 0;
+ const char *prop;
+
+ EINA_ITERATOR_FOREACH(properties, prop)
+ actual_properties_count++;
+ eina_iterator_free(properties);
ck_assert_int_eq(expected_properties_count, actual_properties_count);
_teardown();