aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2019-03-01 10:23:32 -0500
committerMike Blumenkrantz <zmike@samsung.com>2019-03-01 10:23:32 -0500
commitfe82e6fdad37ddfa93153817efd0541d7ccd0b92 (patch)
tree45a6cdf81f805f7767ddf0eb9830f1a91fc8cf17
parentelementary: fix performance example warning by using Eina_Slstr instead of ha... (diff)
downloadefl-fe82e6fdad37ddfa93153817efd0541d7ccd0b92.tar.gz
elementary: fix string usage in hoversel example.
Summary: Depends on https://phab.enlightenment.org/D8073 Reviewers: zmike Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8074
-rw-r--r--src/examples/elementary/hoversel_example_01.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/examples/elementary/hoversel_example_01.c b/src/examples/elementary/hoversel_example_01.c
index 289996cf24..7ce97bb503 100644
--- a/src/examples/elementary/hoversel_example_01.c
+++ b/src/examples/elementary/hoversel_example_01.c
@@ -4,7 +4,6 @@
#include <Elementary.h>
static void _print_items(void *data, Evas_Object *obj, void *event_info);
-static void _free(void *data, Evas_Object *obj, void *event_info);
static void _add_item(void *data, Evas_Object *obj, void *event_info);
static void
@@ -108,21 +107,12 @@ static void
_add_item(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
{
static int num = 0;
- char *str = malloc(sizeof(char) * 11);
- Elm_Object_Item *hoversel_it;
+ Eina_Slstr *str;
if(is_eng)
- snprintf(str, 11, "item %d", ++num);
+ str = eina_slstr_printf("item %d", ++num);
else
- snprintf(str, 11, "بند %d", ++num);
-
- hoversel_it = elm_hoversel_item_add(obj, str, NULL, ELM_ICON_NONE, NULL,
- str);
- elm_object_item_del_cb_set(hoversel_it, _free);
-}
+ str = eina_slstr_printf("بند %d", ++num);
-static void
-_free(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
-{
- free(data);
+ elm_hoversel_item_add(obj, str, NULL, ELM_ICON_NONE, NULL, str);
}