aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/edje/edje_util.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2017-11-13 14:13:08 -0800
committerCedric BAIL <cedric@osg.samsung.com>2017-11-13 14:13:08 -0800
commiteddd52cba7ee8448e9b05d97d014f268d059e887 (patch)
treedcec01f014e4e8e10daec20734ce0f57d0af9628 /src/lib/edje/edje_util.c
parentedje: cleanup life cycle of buffer in _edje_hash_find_helper. (diff)
downloadefl-eddd52cba7ee8448e9b05d97d014f268d059e887.tar.gz
edje: cache last string search miss to reduce useless call to eina_str_split_full by 3.
Diffstat (limited to '')
-rw-r--r--src/lib/edje/edje_util.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c
index fc0015eac9..e37a8d43f7 100644
--- a/src/lib/edje/edje_util.c
+++ b/src/lib/edje/edje_util.c
@@ -5339,6 +5339,7 @@ _edje_real_part_get(const Edje *ed, const char *part)
void *
_edje_hash_find_helper(const Eina_Hash *hash, const char *key)
{
+ static const char *remember_key = NULL;
void *data;
int i, j;
char **tokens;
@@ -5348,8 +5349,12 @@ _edje_hash_find_helper(const Eina_Hash *hash, const char *key)
if (data)
return data;
- tokens = eina_str_split_full(key, "/", 0, &tokens_count);
+ // We only receive pointer from Eet files as key, we can
+ // assume them constant over the life time of the program.
+ if (remember_key == key)
+ return NULL;
+ tokens = eina_str_split_full(key, "/", 0, &tokens_count);
if ((tokens) && (tokens_count > 1))
{
Eina_Strbuf *buf = NULL;
@@ -5373,6 +5378,10 @@ _edje_hash_find_helper(const Eina_Hash *hash, const char *key)
eina_strbuf_free(buf);
}
+ else
+ {
+ remember_key = key;
+ }
if (tokens)
{