summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorabdulleh Ghujeh <a.ghujeh@samsung.com>2019-11-15 10:14:03 +0900
committerWooHyun Jung <wh0705.jung@samsung.com>2019-11-15 10:14:03 +0900
commit2b71b630225c3ca5caee3f4500fe54d4c92000eb (patch)
tree1b921f53dc51d1f599901583c2bb259ce6fb4d68
parent4832d9bfb82ddd0d5fc32759984678cce90fc858 (diff)
downloadefl-2b71b630225c3ca5caee3f4500fe54d4c92000eb.tar.gz
Edje : textblock_styles strncmp improvement
Summary: Improve string comparison Reviewers: cedric, ali.alzyod, woohyun, bu5hm4n Reviewed By: woohyun Subscribers: bu5hm4n, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10635
-rw-r--r--src/lib/edje/edje_textblock_styles.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/edje/edje_textblock_styles.c b/src/lib/edje/edje_textblock_styles.c
index 22bc7aef4b..d2b8aaa4ba 100644
--- a/src/lib/edje/edje_textblock_styles.c
+++ b/src/lib/edje/edje_textblock_styles.c
@@ -52,6 +52,8 @@ _edje_format_parse(const char **s)
return NULL;
}
+#define _IS_STRINGS_EQUAL(str1, len1, str2, len2) (((len1)==(len2)) && !strncmp(str1, str2, len1))
+
static void
_edje_format_reparse(Edje_File *edf, const char *str, Edje_Style_Tag *tag_ret, Eina_Strbuf *result)
{
@@ -68,11 +70,11 @@ _edje_format_reparse(Edje_File *edf, const char *str, Edje_Style_Tag *tag_ret, E
const char *key = item;
const char *val = pos + 1;
- if (!strncmp(key, "font_source", key_len))
+ if (_IS_STRINGS_EQUAL(key, key_len, "font_source", 11))
{
/* dont allow font sources */
}
- else if (!strncmp(key, "text_class", key_len))
+ else if (_IS_STRINGS_EQUAL(key, key_len, "text_class", 10))
{
if (tag_ret)
tag_ret->text_class = eina_stringshare_add(val);
@@ -83,12 +85,12 @@ _edje_format_reparse(Edje_File *edf, const char *str, Edje_Style_Tag *tag_ret, E
free(item);
continue;
}
- else if (!strncmp(key, "font_size", key_len))
+ else if (_IS_STRINGS_EQUAL(key, key_len, "font_size", 9))
{
if (tag_ret)
tag_ret->font_size = atof(val);
}
- else if (!strncmp(key, "font", key_len)) /* Fix fonts */
+ else if (_IS_STRINGS_EQUAL(key, key_len, "font", 4)) /* Fix fonts */
{
if (tag_ret)
{