tasn pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=52d998f475afd1a8cb18e5990aafd7f1c2b5c41e

commit 52d998f475afd1a8cb18e5990aafd7f1c2b5c41e
Author: Tom Hacohen <t...@stosb.com>
Date:   Thu May 28 17:47:33 2015 +0100

    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
---
 src/bindings/eo_cxx/eo_ops.hh                      |  2 +-
 src/examples/ecore/ecore_audio_playback.c          |  2 +-
 src/examples/eo/evas/evas_evas_obj.h               |  2 +-
 src/lib/ecore_audio/ecore_audio_obj_in_tone.c      |  4 +--
 .../ecore_audio/ecore_audio_obj_out_core_audio.c   |  2 +-
 src/lib/ecore_audio/ecore_audio_obj_out_pulse.c    |  2 +-
 src/lib/edje/edje_multisense.c                     |  2 +-
 src/lib/eo/Eo.h                                    |  1 +
 src/lib/eo/eo_base.eo                              |  4 +--
 src/lib/eo/eo_base_class.c                         |  6 +---
 src/lib/evas/canvas/evas_data.c                    |  2 +-
 src/tests/ecore/ecore_test_ecore_audio.c           |  6 ++--
 .../eo/composite_objects/composite_objects_comp.c  |  2 +-
 src/tests/eo/signals/signals_simple.c              |  2 +-
 src/tests/eo/suite/eo_test_general.c               | 42 ++--------------------
 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 94ae7fd..89ed72d 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 efd3036..78c98a3 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 cda7960..61cf720 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 ac83b85..2b097f6 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 7370f18..1d2ead4 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 fffe4c4..901d9f6 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 913c1f9..8d40b0c 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 6c985c4..e2229d9 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 de44698..97bc6bf 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 1dbd6f0..93d5715 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 4686595..38bc537 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 aeea55f..4be231c 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 b933e19..1e59b4d 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 f113e51..67e5f68 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 59cb4db..47064cf 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();
 }

-- 


Reply via email to