bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=5c1fde2c57019c78ef02043fa5130714a0d507dc
commit 5c1fde2c57019c78ef02043fa5130714a0d507dc Author: Marcel Hollerbach <[email protected]> Date: Mon Jan 14 20:28:45 2019 +0100 efl: add free functions to owned types this commit is a first step in order to add free functions to all the types that are owned. Reviewed-by: Cedric BAIL <[email protected]> Differential Revision: https://phab.enlightenment.org/D7627 --- src/lib/efl/Efl.h | 2 ++ src/lib/efl/interfaces/efl_observer.c | 7 +++++++ src/lib/efl/interfaces/efl_types.eot | 2 +- src/lib/elementary/Elementary.h | 2 ++ src/lib/elementary/efl_ui_focus_manager.c | 10 ++++++++++ src/lib/elementary/efl_ui_focus_manager.eo | 10 +++++----- src/lib/eo/eina_types.eot | 2 +- src/tests/elementary/elm_test_focus.c | 2 ++ src/tests/eolian/data/complex_type.eo | 2 +- 9 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/lib/efl/Efl.h b/src/lib/efl/Efl.h index af6154b766..c150cdc9fb 100644 --- a/src/lib/efl/Efl.h +++ b/src/lib/efl/Efl.h @@ -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. * diff --git a/src/lib/efl/interfaces/efl_observer.c b/src/lib/efl/interfaces/efl_observer.c index c7efc30b2c..8656b801b9 100644 --- a/src/lib/efl/interfaces/efl_observer.c +++ b/src/lib/efl/interfaces/efl_observer.c @@ -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" diff --git a/src/lib/efl/interfaces/efl_types.eot b/src/lib/efl/interfaces/efl_types.eot index 06a9426ee8..cf45db8f9c 100644 --- a/src/lib/efl/interfaces/efl_types.eot +++ b/src/lib/efl/interfaces/efl_types.eot @@ -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]] diff --git a/src/lib/elementary/Elementary.h b/src/lib/elementary/Elementary.h index 6050df643a..1aae5e01f5 100644 --- a/src/lib/elementary/Elementary.h +++ b/src/lib/elementary/Elementary.h @@ -153,8 +153,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> diff --git a/src/lib/elementary/efl_ui_focus_manager.c b/src/lib/elementary/efl_ui_focus_manager.c index 2cb14a6790..31afb9dc98 100644 --- a/src/lib/elementary/efl_ui_focus_manager.c +++ b/src/lib/elementary/efl_ui_focus_manager.c @@ -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" diff --git a/src/lib/elementary/efl_ui_focus_manager.eo b/src/lib/elementary/efl_ui_focus_manager.eo index 35614712b7..425ad9de67 100644 --- a/src/lib/elementary/efl_ui_focus_manager.eo +++ b/src/lib/elementary/efl_ui_focus_manager.eo @@ -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]] diff --git a/src/lib/eo/eina_types.eot b/src/lib/eo/eina_types.eot index d0b3dcbcb9..a70a6553e9 100644 --- a/src/lib/eo/eina_types.eot +++ b/src/lib/eo/eina_types.eot @@ -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]] diff --git a/src/tests/elementary/elm_test_focus.c b/src/tests/elementary/elm_test_focus.c index e9bc5a97c9..cfcefb28e3 100644 --- a/src/tests/elementary/elm_test_focus.c +++ b/src/tests/elementary/elm_test_focus.c @@ -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); diff --git a/src/tests/eolian/data/complex_type.eo b/src/tests/eolian/data/complex_type.eo index e8fe1a785e..511a8eee76 100644 --- a/src/tests/eolian/data/complex_type.eo +++ b/src/tests/eolian/data/complex_type.eo @@ -1,4 +1,4 @@ -struct @extern Eo; +struct @free(efl_del) @extern Eo; class Complex_Type { methods { --
