From 10c9ef771f976ff6fc55544588e7dec576387d64 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Fri, 6 May 2016 16:47:56 -0700 Subject: [PATCH] edje: do not check against eet if strings where never allocated. --- src/lib/edje/edje_edit.c | 3 +++ src/lib/edje/edje_private.h | 1 + src/lib/edje/edje_textblock_styles.c | 7 +++++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c index e97c44f..da63dd7 100644 --- a/src/lib/edje/edje_edit.c +++ b/src/lib/edje/edje_edit.c @@ -821,12 +821,14 @@ _edje_if_string_free(Edje *ed, const char **str) Eet_Dictionary *dict; if (!ed || !str) return; + if (!ed->file->allocated_strings) goto the_end; dict = eet_dictionary_get(ed->file->ef); if (!eet_dictionary_string_check(dict, *str)) eina_stringshare_del(*str); + the_end: *str = NULL; } @@ -837,6 +839,7 @@ _edje_if_string_replace(Edje *ed, const char **str, const char *str_new) if (!ed || !str) return; + ed->file->allocated_strings = EINA_TRUE; dict = eet_dictionary_get(ed->file->ef); if (*str && eet_dictionary_string_check(dict, *str)) *str = eina_stringshare_add(str_new); diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index 4681476..c70f282 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h @@ -577,6 +577,7 @@ struct _Edje_File char fid[8+8+8+2]; unsigned char free_strings : 1; + unsigned char allocated_strings : 1; unsigned char dangling : 1; unsigned char warning : 1; }; diff --git a/src/lib/edje/edje_textblock_styles.c b/src/lib/edje/edje_textblock_styles.c index 0cf8a05..2fef836 100644 --- a/src/lib/edje/edje_textblock_styles.c +++ b/src/lib/edje/edje_textblock_styles.c @@ -463,7 +463,8 @@ _edje_textblock_style_parse_and_fix(Edje_File *edf) /* Add and Handle tag parsed data */ if (ts) { - if (eet_dictionary_string_check(eet_dictionary_get(edf->ef), tag->value) == 0) + if (edf->allocated_strings && + eet_dictionary_string_check(eet_dictionary_get(edf->ef), tag->value) == 0) eina_stringshare_del(tag->value); tag->value = eina_stringshare_add(ts); eina_strbuf_append(txt, tag->value); @@ -522,7 +523,9 @@ _edje_textblock_style_cleanup(Edje_File *edf) EINA_LIST_FREE(stl->tags, tag) { - if (tag->value && eet_dictionary_string_check(eet_dictionary_get(edf->ef), tag->value) == 0) + if (edf->allocated_strings && + tag->value && + eet_dictionary_string_check(eet_dictionary_get(edf->ef), tag->value) == 0) eina_stringshare_del(tag->value); if (edf->free_strings) { -- 2.7.4