forked from enlightenment/efl
eo base - remove the duplicated key dels and just do eo_key_del() now
this rationalizes all the duplicated key dels (key_data, key_obj and key_value).
This commit is contained in:
parent
b63b00c1b8
commit
5e09d1307b
|
@ -87,7 +87,7 @@ base_data_get(const Eo *obj, const char *key)
|
||||||
inline void
|
inline void
|
||||||
base_data_del(Eo *obj, const char *key)
|
base_data_del(Eo *obj, const char *key)
|
||||||
{
|
{
|
||||||
eo_key_data_del(obj, key);
|
eo_key_del(obj, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
|
|
|
@ -101,7 +101,7 @@ ffi.cdef [[
|
||||||
void eo_key_data_set(const char *key, const void *data,
|
void eo_key_data_set(const char *key, const void *data,
|
||||||
eo_key_data_free_func free_func);
|
eo_key_data_free_func free_func);
|
||||||
void *eo_key_data_get(const char *key);
|
void *eo_key_data_get(const char *key);
|
||||||
void eo_key_data_del(const char *key);
|
void eo_key_del(const char *key);
|
||||||
|
|
||||||
Eina_Iterator *eo_children_iterator_new(void);
|
Eina_Iterator *eo_children_iterator_new(void);
|
||||||
|
|
||||||
|
|
|
@ -590,7 +590,7 @@ end:
|
||||||
pd->items = (Grid_Item *)
|
pd->items = (Grid_Item *)
|
||||||
eina_inlist_remove(EINA_INLIST_GET(pd->items), EINA_INLIST_GET(gi));
|
eina_inlist_remove(EINA_INLIST_GET(pd->items), EINA_INLIST_GET(gi));
|
||||||
pd->count--;
|
pd->count--;
|
||||||
eo_key_data_del(subobj, GRID_ITEM_KEY);
|
eo_key_del(subobj, GRID_ITEM_KEY);
|
||||||
free(gi);
|
free(gi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3913,7 +3913,7 @@ _local_elm_drop_target_del(Evas_Object *obj, Elm_Sel_Format format,
|
||||||
if (!dropable->cbs_list)
|
if (!dropable->cbs_list)
|
||||||
{
|
{
|
||||||
drops = eina_list_remove(drops, dropable);
|
drops = eina_list_remove(drops, dropable);
|
||||||
eo_key_data_del(obj, "__elm_dropable");
|
eo_key_del(obj, "__elm_dropable");
|
||||||
free(dropable);
|
free(dropable);
|
||||||
dropable = NULL;
|
dropable = NULL;
|
||||||
evas_object_event_callback_del(obj, EVAS_CALLBACK_DEL,
|
evas_object_event_callback_del(obj, EVAS_CALLBACK_DEL,
|
||||||
|
|
|
@ -221,7 +221,7 @@ abstract Eo.Base ()
|
||||||
}
|
}
|
||||||
return: void *; [[the data for the key]]
|
return: void *; [[the data for the key]]
|
||||||
}
|
}
|
||||||
key_data_del {
|
key_del {
|
||||||
[[Del generic data from object.]]
|
[[Del generic data from object.]]
|
||||||
params {
|
params {
|
||||||
@in key: const(char)*; [[the key associated with the data]]
|
@in key: const(char)*; [[the key associated with the data]]
|
||||||
|
@ -250,12 +250,6 @@ abstract Eo.Base ()
|
||||||
}
|
}
|
||||||
return: Eo.Base *; [[the object reference for the key]]
|
return: Eo.Base *; [[the object reference for the key]]
|
||||||
}
|
}
|
||||||
key_obj_del {
|
|
||||||
[[Del generic objecrt reference from object.]]
|
|
||||||
params {
|
|
||||||
@in key: const(char)*; [[the key associated with the object ref]]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
key_value_set {
|
key_value_set {
|
||||||
[[Set value on the object.
|
[[Set value on the object.
|
||||||
|
|
||||||
|
@ -278,12 +272,6 @@ abstract Eo.Base ()
|
||||||
}
|
}
|
||||||
return: Eina.Value *; [[the value for the key]]
|
return: Eina.Value *; [[the value for the key]]
|
||||||
}
|
}
|
||||||
key_value_del {
|
|
||||||
[[Del generic value from object.]]
|
|
||||||
params {
|
|
||||||
@in key: const(char)*; [[the key associated with the value]]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
event_thaw {
|
event_thaw {
|
||||||
[[thaw events of object.
|
[[thaw events of object.
|
||||||
|
|
||||||
|
|
|
@ -188,7 +188,7 @@ _eo_base_key_data_get(const Eo *obj, Eo_Base_Data *pd, const char *key)
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_eo_base_key_data_del(Eo *obj, Eo_Base_Data *pd, const char *key)
|
_eo_base_key_del(Eo *obj, Eo_Base_Data *pd, const char *key)
|
||||||
{
|
{
|
||||||
Eo_Generic_Data_Node *node;
|
Eo_Generic_Data_Node *node;
|
||||||
|
|
||||||
|
@ -276,31 +276,6 @@ _eo_base_key_obj_get(const Eo *obj, Eo_Base_Data *pd, const char *key)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
|
||||||
_eo_base_key_obj_del(Eo *obj EINA_UNUSED, Eo_Base_Data *pd, const char *key)
|
|
||||||
{
|
|
||||||
Eo_Generic_Data_Node *node;
|
|
||||||
|
|
||||||
if (!key) return;
|
|
||||||
EINA_INLIST_FOREACH(pd->generic_data, node)
|
|
||||||
{
|
|
||||||
if (!strcmp(node->key, key))
|
|
||||||
{
|
|
||||||
pd->generic_data = eina_inlist_remove(pd->generic_data,
|
|
||||||
EINA_INLIST_GET(node));
|
|
||||||
if (node->data_is_obj)
|
|
||||||
{
|
|
||||||
eo_event_callback_del(node->data, EO_BASE_EVENT_DEL,
|
|
||||||
_eo_base_cb_key_obj_del, obj);
|
|
||||||
eo_unref(node->data);
|
|
||||||
}
|
|
||||||
else if (node->data_is_value) eina_value_free(node->data);
|
|
||||||
_eo_generic_data_node_free(node);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_eo_base_key_value_set(Eo *obj, Eo_Base_Data *pd, const char *key, Eina_Value *value)
|
_eo_base_key_value_set(Eo *obj, Eo_Base_Data *pd, const char *key, Eina_Value *value)
|
||||||
{
|
{
|
||||||
|
@ -364,31 +339,6 @@ _eo_base_key_value_get(const Eo *obj, Eo_Base_Data *pd, const char *key)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
|
||||||
_eo_base_key_value_del(Eo *obj EINA_UNUSED, Eo_Base_Data *pd, const char *key)
|
|
||||||
{
|
|
||||||
Eo_Generic_Data_Node *node;
|
|
||||||
|
|
||||||
if (!key) return;
|
|
||||||
EINA_INLIST_FOREACH(pd->generic_data, node)
|
|
||||||
{
|
|
||||||
if (!strcmp(node->key, key))
|
|
||||||
{
|
|
||||||
pd->generic_data = eina_inlist_remove(pd->generic_data,
|
|
||||||
EINA_INLIST_GET(node));
|
|
||||||
if (node->data_is_obj)
|
|
||||||
{
|
|
||||||
eo_event_callback_del(node->data, EO_BASE_EVENT_DEL,
|
|
||||||
_eo_base_cb_key_obj_del, obj);
|
|
||||||
eo_unref(node->data);
|
|
||||||
}
|
|
||||||
else if (node->data_is_value) eina_value_free(node->data);
|
|
||||||
_eo_generic_data_node_free(node);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_eo_base_id_set(Eo *obj EINA_UNUSED, Eo_Base_Data *pd, const char *id)
|
_eo_base_id_set(Eo *obj EINA_UNUSED, Eo_Base_Data *pd, const char *id)
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,6 +30,6 @@ evas_object_data_del(Evas_Object *obj, const char *key)
|
||||||
MAGIC_CHECK_END();
|
MAGIC_CHECK_END();
|
||||||
void *data = NULL;
|
void *data = NULL;
|
||||||
data = eo_key_data_get(obj, key);
|
data = eo_key_data_get(obj, key);
|
||||||
eo_key_data_del(obj, key);
|
eo_key_del(obj, key);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
|
@ -608,7 +608,7 @@ START_TEST(eo_generic_data)
|
||||||
eo_key_data_set(obj, "test1", (void *) 1);
|
eo_key_data_set(obj, "test1", (void *) 1);
|
||||||
data = eo_key_data_get(obj, "test1");
|
data = eo_key_data_get(obj, "test1");
|
||||||
fail_if(1 != (intptr_t) data);
|
fail_if(1 != (intptr_t) data);
|
||||||
eo_key_data_del(obj, "test1");
|
eo_key_del(obj, "test1");
|
||||||
data = eo_key_data_get(obj, "test1");
|
data = eo_key_data_get(obj, "test1");
|
||||||
fail_if(data);
|
fail_if(data);
|
||||||
|
|
||||||
|
@ -621,13 +621,13 @@ START_TEST(eo_generic_data)
|
||||||
|
|
||||||
data = eo_key_data_get(obj, "test2");
|
data = eo_key_data_get(obj, "test2");
|
||||||
fail_if(2 != (intptr_t) data);
|
fail_if(2 != (intptr_t) data);
|
||||||
eo_key_data_del(obj, "test2");
|
eo_key_del(obj, "test2");
|
||||||
data = eo_key_data_get(obj, "test2");
|
data = eo_key_data_get(obj, "test2");
|
||||||
fail_if(data);
|
fail_if(data);
|
||||||
|
|
||||||
data = eo_key_data_get(obj, "test1");
|
data = eo_key_data_get(obj, "test1");
|
||||||
fail_if(1 != (intptr_t) data);
|
fail_if(1 != (intptr_t) data);
|
||||||
eo_key_data_del(obj, "test1");
|
eo_key_del(obj, "test1");
|
||||||
data = eo_key_data_get(obj, "test1");
|
data = eo_key_data_get(obj, "test1");
|
||||||
fail_if(data);
|
fail_if(data);
|
||||||
|
|
||||||
|
@ -671,6 +671,7 @@ START_TEST(eo_generic_data)
|
||||||
eo_key_value_del(obj, "value1");
|
eo_key_value_del(obj, "value1");
|
||||||
value2 = eo_key_value_get(obj, "value1");
|
value2 = eo_key_value_get(obj, "value1");
|
||||||
fail_if(value2 != NULL);
|
fail_if(value2 != NULL);
|
||||||
|
eo_key_del(obj, "value1");
|
||||||
|
|
||||||
eo_unref(obj);
|
eo_unref(obj);
|
||||||
eo_unref(obj2);
|
eo_unref(obj2);
|
||||||
|
|
Loading…
Reference in New Issue