edje - we can't rely on string ptr coming from eet file anymore...

This commit is contained in:
Carsten Haitzler 2021-08-09 18:22:06 +01:00
parent 0a3a28525c
commit a5c7c65658
1 changed files with 0 additions and 19 deletions

View File

@ -5812,7 +5812,6 @@ _edje_real_part_get(const Edje *ed, const char *part)
void * void *
_edje_hash_find_helper(const Eina_Hash *hash, const char *key) _edje_hash_find_helper(const Eina_Hash *hash, const char *key)
{ {
static const char *remember_key = NULL;
void *data; void *data;
int i, j; int i, j;
char **tokens; char **tokens;
@ -5822,20 +5821,6 @@ _edje_hash_find_helper(const Eina_Hash *hash, const char *key)
if (data) if (data)
return data; return data;
// 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;
// It is usually faster to walk the string once to check
// if there will be any tokens to process, that to allocate
// an array, copy one token, and then just free it.
if (strchr(key, '/') == NULL)
{
remember_key = key;
return NULL;
}
tokens = eina_str_split_full(key, "/", 0, &tokens_count); tokens = eina_str_split_full(key, "/", 0, &tokens_count);
if ((tokens) && (tokens_count > 1)) if ((tokens) && (tokens_count > 1))
{ {
@ -5860,10 +5845,6 @@ _edje_hash_find_helper(const Eina_Hash *hash, const char *key)
eina_strbuf_free(buf); eina_strbuf_free(buf);
} }
else
{
remember_key = key;
}
if (tokens) if (tokens)
{ {