aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2015-05-28 17:47:33 +0100
committerTom Hacohen <tom@stosb.com>2015-05-28 17:47:59 +0100
commit52d998f475afd1a8cb18e5990aafd7f1c2b5c41e (patch)
treea392364afb9663810e94776ebde6dc99a52cf2f2 /src
parentEo base: Fix Eolian files to use Eo.Base instead of Eo. (diff)
downloadefl-52d998f475afd1a8cb18e5990aafd7f1c2b5c41e.tar.gz
Eo base: Remove the free_func parameter from key_data_set.
This was not really useful and against the Eolian guidelines. While I promised I won't break things until the 27th, I was ill (still am), so I'm giving myself a 1 day pass. :P
Diffstat (limited to 'src')
-rw-r--r--src/bindings/eo_cxx/eo_ops.hh2
-rw-r--r--src/examples/ecore/ecore_audio_playback.c2
-rw-r--r--src/examples/eo/evas/evas_evas_obj.h2
-rw-r--r--src/lib/ecore_audio/ecore_audio_obj_in_tone.c4
-rw-r--r--src/lib/ecore_audio/ecore_audio_obj_out_core_audio.c2
-rw-r--r--src/lib/ecore_audio/ecore_audio_obj_out_pulse.c2
-rw-r--r--src/lib/edje/edje_multisense.c2
-rw-r--r--src/lib/eo/Eo.h1
-rw-r--r--src/lib/eo/eo_base.eo4
-rw-r--r--src/lib/eo/eo_base_class.c6
-rw-r--r--src/lib/evas/canvas/evas_data.c2
-rw-r--r--src/tests/ecore/ecore_test_ecore_audio.c6
-rw-r--r--src/tests/eo/composite_objects/composite_objects_comp.c2
-rw-r--r--src/tests/eo/signals/signals_simple.c2
-rw-r--r--src/tests/eo/suite/eo_test_general.c42
15 files changed, 21 insertions, 60 deletions
diff --git a/src/bindings/eo_cxx/eo_ops.hh b/src/bindings/eo_cxx/eo_ops.hh
index 94ae7fdc15..89ed72d25c 100644
--- a/src/bindings/eo_cxx/eo_ops.hh
+++ b/src/bindings/eo_cxx/eo_ops.hh
@@ -68,7 +68,7 @@ inline void
base_data_set(const Eo *obj, const char *key, const void *data,
eo_key_data_free_func free_func = NULL)
{
- eo_do(obj, eo_key_data_set(key, data, free_func));
+ eo_do(obj, eo_key_data_set(key, data));
}
inline void*
diff --git a/src/examples/ecore/ecore_audio_playback.c b/src/examples/ecore/ecore_audio_playback.c
index efd3036aa2..78c98a366a 100644
--- a/src/examples/ecore/ecore_audio_playback.c
+++ b/src/examples/ecore/ecore_audio_playback.c
@@ -266,7 +266,7 @@ main(int argc, const char *argv[])
{
if (!strncmp(val, "freq=", 5)) {
freq = atoi(&val[5]);
- eo_do(in, eo_key_data_set(ECORE_AUDIO_ATTR_TONE_FREQ, &freq, NULL));
+ eo_do(in, eo_key_data_set(ECORE_AUDIO_ATTR_TONE_FREQ, &freq));
} else if (!strncmp(val, "duration=", 9)) {
eo_do(in, ecore_audio_obj_in_length_set(atof(&val[9])));
}
diff --git a/src/examples/eo/evas/evas_evas_obj.h b/src/examples/eo/evas/evas_evas_obj.h
index cda796023d..61cf7201ef 100644
--- a/src/examples/eo/evas/evas_evas_obj.h
+++ b/src/examples/eo/evas/evas_evas_obj.h
@@ -84,7 +84,7 @@ eo_evas_object_get(const Eo *obj)
static inline void
eo_evas_object_set(Eo *obj, Evas_Object *evas_obj)
{
- eo_do(obj, eo_key_data_set(EXEVAS_OBJ_STR, evas_obj, NULL));
+ eo_do(obj, eo_key_data_set(EXEVAS_OBJ_STR, evas_obj));
}
#endif
diff --git a/src/lib/ecore_audio/ecore_audio_obj_in_tone.c b/src/lib/ecore_audio/ecore_audio_obj_in_tone.c
index ac83b85766..2b097f66f1 100644
--- a/src/lib/ecore_audio/ecore_audio_obj_in_tone.c
+++ b/src/lib/ecore_audio/ecore_audio_obj_in_tone.c
@@ -83,14 +83,14 @@ _ecore_audio_in_tone_ecore_audio_in_length_set(Eo *eo_obj, Ecore_Audio_In_Tone_D
}
EOLIAN static void
-_ecore_audio_in_tone_eo_base_key_data_set(Eo *eo_obj, Ecore_Audio_In_Tone_Data *obj, const char *key, const void *val, eo_key_data_free_func func)
+_ecore_audio_in_tone_eo_base_key_data_set(Eo *eo_obj, Ecore_Audio_In_Tone_Data *obj, const char *key, const void *val)
{
if (!key) return;
if (!strcmp(key, ECORE_AUDIO_ATTR_TONE_FREQ)) {
obj->freq = *(int *)val;
} else {
- eo_do_super(eo_obj, MY_CLASS, eo_key_data_set(key, val, func));
+ eo_do_super(eo_obj, MY_CLASS, eo_key_data_set(key, val));
}
}
diff --git a/src/lib/ecore_audio/ecore_audio_obj_out_core_audio.c b/src/lib/ecore_audio/ecore_audio_obj_out_core_audio.c
index 7370f18ec7..1d2ead4566 100644
--- a/src/lib/ecore_audio/ecore_audio_obj_out_core_audio.c
+++ b/src/lib/ecore_audio/ecore_audio_obj_out_core_audio.c
@@ -303,7 +303,7 @@ _ecore_audio_out_core_audio_ecore_audio_out_input_attach(Eo *obj, Ecore_Audio_Ou
}
/* Keep track of data for deallocation */
- eo_do(input, eo_key_data_set("coreaudio_data", helper, NULL));
+ eo_do(input, eo_key_data_set("coreaudio_data", helper));
/* Start playing */
helper->is_playing = EINA_TRUE;
diff --git a/src/lib/ecore_audio/ecore_audio_obj_out_pulse.c b/src/lib/ecore_audio/ecore_audio_obj_out_pulse.c
index fffe4c47d8..901d9f6e3e 100644
--- a/src/lib/ecore_audio/ecore_audio_obj_out_pulse.c
+++ b/src/lib/ecore_audio/ecore_audio_obj_out_pulse.c
@@ -136,7 +136,7 @@ static Eina_Bool _input_attach_internal(Eo *eo_obj, Eo *in)
eo_do(in, eo_event_callback_add(ECORE_AUDIO_IN_EVENT_IN_SAMPLERATE_CHANGED, _update_samplerate_cb, eo_obj));
- eo_do(in, eo_key_data_set("pulse_data", stream, NULL));
+ eo_do(in, eo_key_data_set("pulse_data", stream));
pa_stream_set_write_callback(stream, _write_cb, in);
diff --git a/src/lib/edje/edje_multisense.c b/src/lib/edje/edje_multisense.c
index 913c1f9a89..8d40b0c590 100644
--- a/src/lib/edje/edje_multisense.c
+++ b/src/lib/edje/edje_multisense.c
@@ -271,7 +271,7 @@ _edje_multisense_internal_sound_tone_play(Edje *ed, const char *tone_name, const
{
in = eo_add(ECORE_AUDIO_IN_TONE_CLASS, NULL);
eo_do(in, ecore_audio_obj_name_set("tone"));
- eo_do(in, eo_key_data_set(ECORE_AUDIO_ATTR_TONE_FREQ, &tone->value, NULL));
+ eo_do(in, eo_key_data_set(ECORE_AUDIO_ATTR_TONE_FREQ, &tone->value));
eo_do(in, ecore_audio_obj_in_length_set(duration));
eo_do(in, eo_event_callback_add(ECORE_AUDIO_IN_EVENT_IN_STOPPED, _play_finished, NULL));
diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h
index 6c985c4d20..e2229d96c3 100644
--- a/src/lib/eo/Eo.h
+++ b/src/lib/eo/Eo.h
@@ -891,6 +891,7 @@ EAPI Eina_Bool eo_destructed_is(const Eo *obj);
/**
* @typedef eo_key_data_free_func
* Data free func prototype.
+ * XXX: DO NOT USE, only here for legacy.
*/
typedef void (*eo_key_data_free_func)(void *);
diff --git a/src/lib/eo/eo_base.eo b/src/lib/eo/eo_base.eo
index de44698bfa..97bc6bff27 100644
--- a/src/lib/eo/eo_base.eo
+++ b/src/lib/eo/eo_base.eo
@@ -69,11 +69,11 @@ This function registers the object handle pointed by wref to obj so when obj is
}
}
key_data_set {
- /*@ Set generic data to object. */
+ /*@ Set generic data to object.
+ The user is in change to free the data. */
params {
@in key: const(char)*; /*@ the key associated with the data */
@in data: const(void)*; /*@ the data to set */
- @in free_func: eo_key_data_free_func; /*@ the func to free data with (NULL means */
}
}
key_data_get {
diff --git a/src/lib/eo/eo_base_class.c b/src/lib/eo/eo_base_class.c
index 1dbd6f0358..93d57158b0 100644
--- a/src/lib/eo/eo_base_class.c
+++ b/src/lib/eo/eo_base_class.c
@@ -34,15 +34,12 @@ typedef struct
EINA_INLIST;
Eina_Stringshare *key;
void *data;
- eo_key_data_free_func free_func;
} Eo_Generic_Data_Node;
static void
_eo_generic_data_node_free(Eo_Generic_Data_Node *node)
{
eina_stringshare_del(node->key);
- if (node->free_func)
- node->free_func(node->data);
free(node);
}
@@ -63,7 +60,7 @@ _eo_generic_data_del_all(Eo_Base_Data *pd)
EOLIAN static void
_eo_base_key_data_set(Eo *obj, Eo_Base_Data *pd,
- const char *key, const void *data, eo_key_data_free_func free_func)
+ const char *key, const void *data)
{
Eo_Generic_Data_Node *node;
@@ -75,7 +72,6 @@ _eo_base_key_data_set(Eo *obj, Eo_Base_Data *pd,
if (!node) return;
node->key = eina_stringshare_add(key);
node->data = (void *) data;
- node->free_func = free_func;
pd->generic_data = eina_inlist_prepend(pd->generic_data,
EINA_INLIST_GET(node));
}
diff --git a/src/lib/evas/canvas/evas_data.c b/src/lib/evas/canvas/evas_data.c
index 4686595d36..38bc53741b 100644
--- a/src/lib/evas/canvas/evas_data.c
+++ b/src/lib/evas/canvas/evas_data.c
@@ -8,7 +8,7 @@ evas_object_data_set(Evas_Object *obj, const char *key, const void *data)
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
return;
MAGIC_CHECK_END();
- eo_do(obj, eo_key_data_set(key, data, NULL));
+ eo_do(obj, eo_key_data_set(key, data));
}
EAPI void *
diff --git a/src/tests/ecore/ecore_test_ecore_audio.c b/src/tests/ecore/ecore_test_ecore_audio.c
index aeea55fc18..4be231c39c 100644
--- a/src/tests/ecore/ecore_test_ecore_audio.c
+++ b/src/tests/ecore/ecore_test_ecore_audio.c
@@ -116,7 +116,7 @@ START_TEST(ecore_test_ecore_audio_cleanup)
in = eo_add(ECORE_AUDIO_IN_TONE_CLASS, NULL);
fail_if(!in);
- eo_do(in, eo_key_data_set(ECORE_AUDIO_ATTR_TONE_FREQ, &freq, NULL));
+ eo_do(in, eo_key_data_set(ECORE_AUDIO_ATTR_TONE_FREQ, &freq));
eo_do(in, ecore_audio_obj_in_length_set(2));
out = eo_add(ECORE_AUDIO_OUT_SNDFILE_CLASS, NULL);
@@ -170,12 +170,12 @@ START_TEST(ecore_test_ecore_audio_obj_tone)
fail_if(freq != 1000);
freq = 2000;
- eo_do(in, eo_key_data_set(ECORE_AUDIO_ATTR_TONE_FREQ, &freq, NULL));
+ eo_do(in, eo_key_data_set(ECORE_AUDIO_ATTR_TONE_FREQ, &freq));
eo_do(in, freq = (intptr_t) eo_key_data_get(ECORE_AUDIO_ATTR_TONE_FREQ));
fail_if(freq != 2000);
- eo_do(in, eo_key_data_set("foo", "bar", NULL));
+ eo_do(in, eo_key_data_set("foo", "bar"));
eo_do(in, tmp = eo_key_data_get("foo"));
ck_assert_str_eq(tmp, "bar");
diff --git a/src/tests/eo/composite_objects/composite_objects_comp.c b/src/tests/eo/composite_objects/composite_objects_comp.c
index b933e19dd1..1e59b4d115 100644
--- a/src/tests/eo/composite_objects/composite_objects_comp.c
+++ b/src/tests/eo/composite_objects/composite_objects_comp.c
@@ -34,7 +34,7 @@ _constructor(Eo *obj, void *class_data EINA_UNUSED)
fail_if(eo_do_ret(obj, tmp, eo_composite_part_is()));
fail_if(!eo_do_ret(simple, tmp, eo_composite_part_is()));
- eo_do(obj, eo_key_data_set("simple-obj", simple, NULL));
+ eo_do(obj, eo_key_data_set("simple-obj", simple));
return obj;
}
diff --git a/src/tests/eo/signals/signals_simple.c b/src/tests/eo/signals/signals_simple.c
index f113e511d9..67e5f68c01 100644
--- a/src/tests/eo/signals/signals_simple.c
+++ b/src/tests/eo/signals/signals_simple.c
@@ -68,7 +68,7 @@ _constructor(Eo *obj, void *class_data EINA_UNUSED)
eo_do(obj, eo_event_callback_add(EO_EV_CALLBACK_ADD, _cb_added, NULL));
eo_do(obj, eo_event_callback_add(EO_EV_CALLBACK_DEL, _cb_deled, NULL));
- eo_do(obj, eo_key_data_set("cb_count", (intptr_t) 0, NULL));
+ eo_do(obj, eo_key_data_set("cb_count", (intptr_t) 0));
return obj;
}
diff --git a/src/tests/eo/suite/eo_test_general.c b/src/tests/eo/suite/eo_test_general.c
index 59cb4db92a..47064cf373 100644
--- a/src/tests/eo/suite/eo_test_general.c
+++ b/src/tests/eo/suite/eo_test_general.c
@@ -547,31 +547,21 @@ START_TEST(eo_weak_reference)
}
END_TEST
-static void
-_fake_free_func(void *data)
-{
- if (!data)
- return;
-
- int *a = data;
- ++*a;
-}
-
START_TEST(eo_generic_data)
{
eo_init();
Eo *obj = eo_add(SIMPLE_CLASS, NULL);
void *data = NULL;
- eo_do(obj, eo_key_data_set("test1", (void *) 1, NULL));
+ eo_do(obj, eo_key_data_set("test1", (void *) 1));
eo_do(obj, data = eo_key_data_get("test1"));
fail_if(1 != (intptr_t) data);
eo_do(obj, eo_key_data_del("test1"));
eo_do(obj, data = eo_key_data_get("test1"));
fail_if(data);
- eo_do(obj, eo_key_data_set("test1", (void *) 1, NULL));
- eo_do(obj, eo_key_data_set("test2", (void *) 2, NULL));
+ eo_do(obj, eo_key_data_set("test1", (void *) 1));
+ eo_do(obj, eo_key_data_set("test2", (void *) 2));
eo_do(obj, data = eo_key_data_get("test1"));
fail_if(1 != (intptr_t) data);
eo_do(obj, data = eo_key_data_get("test2"));
@@ -589,33 +579,7 @@ START_TEST(eo_generic_data)
eo_do(obj, data = eo_key_data_get("test1"));
fail_if(data);
- int a = 0;
- eo_do(obj, eo_key_data_set("test3", &a, _fake_free_func));
- eo_do(obj, data = eo_key_data_get("test3"));
- fail_if(&a != data);
- eo_do(obj, eo_key_data_get("test3"));
- eo_do(obj, eo_key_data_del("test3"));
- fail_if(a != 1);
-
- a = 0;
- eo_do(obj, eo_key_data_set("test3", &a, _fake_free_func));
- eo_do(obj, eo_key_data_set("test3", NULL, _fake_free_func));
- fail_if(a != 1);
- a = 0;
- data = (void *) 123;
- eo_do(obj, eo_key_data_set(NULL, &a, _fake_free_func));
- eo_do(obj, data = eo_key_data_get(NULL));
- fail_if(data);
- eo_do(obj, eo_key_data_del(NULL));
-
- a = 0;
- eo_do(obj, eo_key_data_set("test3", &a, _fake_free_func));
- eo_do(obj, eo_key_data_set("test3", NULL, NULL));
- fail_if(a != 1);
- eo_do(obj, eo_key_data_set("test3", &a, _fake_free_func));
-
eo_unref(obj);
- fail_if(a != 2);
eo_shutdown();
}