efl: add free functions to owned types
authorMarcel Hollerbach <mail@marcel-hollerbach.de>
Mon, 14 Jan 2019 19:28:45 +0000 (20:28 +0100)
committerJunsuChoi <jsuya.choi@samsung.com>
Thu, 24 Jan 2019 05:20:19 +0000 (14:20 +0900)
this commit is a first step in order to add free functions to all the
types that are owned.

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D7627

src/lib/efl/Efl.h
src/lib/efl/interfaces/efl_observer.c
src/lib/efl/interfaces/efl_types.eot
src/lib/elementary/Elementary.h
src/lib/elementary/efl_ui_focus_manager.c
src/lib/elementary/efl_ui_focus_manager.eo
src/lib/eo/eina_types.eot
src/tests/elementary/elm_test_focus.c
src/tests/eolian/data/complex_type.eo

index af6154b..c150cdc 100644 (file)
@@ -182,6 +182,8 @@ typedef Efl_Gfx_Path_Command_Type Efl_Gfx_Path_Command;
 #include "interfaces/efl_text_markup.eo.h"
 #include "interfaces/efl_text_markup_util.eo.h"
 
+EAPI void efl_observable_tuple_free(Efl_Observable_Tuple *tuple);
+
 /**
  * @brief Get a proxy object referring to a part of an object.
  *
index c7efc30..8656b80 100644 (file)
@@ -257,5 +257,12 @@ _efl_observable_iterator_tuple_new(Eo *obj, Efl_Observable_Data *pd)
    return &it->iterator;
 }
 
+EAPI void
+efl_observable_tuple_free(Efl_Observable_Tuple *tuple)
+{
+   //key is not owned
+   eina_iterator_free(tuple->data);
+}
+
 #include "interfaces/efl_observable.eo.c"
 #include "interfaces/efl_observer.eo.c"
index 06a9426..cf45db8 100644 (file)
@@ -39,7 +39,7 @@ struct Efl.Version
    build_id: string; [[Contains $EFL_BUILD_ID.]]
 }
 
-struct Efl.Observable_Tuple
+struct @free(efl_observable_tuple_free) Efl.Observable_Tuple
 {
    [[This type describes an observable touple]]
    key: string; [[Touple key]]
index d805446..41a7562 100644 (file)
@@ -159,8 +159,10 @@ EAPI extern Elm_Version *elm_version;
 typedef Eo Efl_Ui_Focus_Manager;
 #define _EFL_UI_FOCUS_MANAGER_EO_CLASS_TYPE
 
+
 # include <efl_ui_focus_object.eo.h>
 # include <efl_ui_focus_manager.eo.h>
+EAPI void efl_ui_focus_relation_free(Efl_Ui_Focus_Relations *rel);
 # include <efl_ui_focus_manager_window_root.eo.h>
 # include <efl_ui_focus_manager_calc.eo.h>
 # include <efl_ui_focus_manager_sub.eo.h>
index 2cb14a6..31afb9d 100644 (file)
@@ -5,5 +5,15 @@
 #include <Elementary.h>
 #include "elm_priv.h"
 
+EAPI void
+efl_ui_focus_relation_free(Efl_Ui_Focus_Relations *rel)
+{
+   eina_list_free(rel->right);
+   eina_list_free(rel->left);
+   eina_list_free(rel->top);
+   eina_list_free(rel->down);
+   free(rel);
+}
+
 #include "efl_ui_focus_manager.eo.c"
 #include "efl_ui_focus_manager_window_root.eo.c"
index 3561471..425ad9d 100644 (file)
@@ -1,15 +1,15 @@
 import efl_ui;
 import eina_types;
 
-struct Efl.Ui.Focus.Relations {
+struct @free(efl_ui_focus_relation_free) Efl.Ui.Focus.Relations {
     [[Structure holding the graph of relations between focussable objects.
 
       @since 1.20
     ]]
-    right : list<Efl.Ui.Focus.Object>; [[List of objects on the right side]]
-    left : list<Efl.Ui.Focus.Object>; [[[List of objects on the left side]]
-    top : list<Efl.Ui.Focus.Object>; [[[List of objects above]]
-    down : list<Efl.Ui.Focus.Object>; [[[List of objects below]]
+    right : list<Efl.Ui.Focus.Object> @owned; [[List of objects on the right side]]
+    left : list<Efl.Ui.Focus.Object> @owned; [[[List of objects on the left side]]
+    top : list<Efl.Ui.Focus.Object> @owned; [[[List of objects above]]
+    down : list<Efl.Ui.Focus.Object> @owned; [[[List of objects below]]
     next : Efl.Ui.Focus.Object; [[[Next object]]
     prev : Efl.Ui.Focus.Object; [[Previous object]]
     parent : Efl.Ui.Focus.Object; [[Parent object]]
index d0b3dcb..a70a655 100644 (file)
@@ -99,7 +99,7 @@ struct @extern Eina.Stat {
     ctimensec: ulong; [[The nano version of the timestmap when the file was created]]
 }
 
-struct @extern Eina.Promise; [[Eina promise type]]
+struct @extern @free(eina_promise_free) Eina.Promise; [[Eina promise type]]
 
 /* FIXME: This definitely shouldn't be here. */
 type Efl.Event_Cb: __undefined_type; [[Efl event callback type]]
index e9bc5a9..cfcefb2 100644 (file)
@@ -144,6 +144,8 @@ EFL_START_TEST(pos_check2)
 
 #undef ck_assert_set_eq
 
+   efl_ui_focus_relation_free(rel);
+
    efl_unref(middle);
    efl_unref(north_east);
    efl_unref(north_west);
index e8fe1a7..511a8ee 100644 (file)
@@ -1,4 +1,4 @@
-struct @extern Eo;
+struct @free(efl_del) @extern Eo;
 
 class Complex_Type {
    methods {