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)
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)
52 return NULL; 52 return NULL;
53} 53}
54 54
55#define _IS_STRINGS_EQUAL(str1, len1, str2, len2) (((len1)==(len2)) && !strncmp(str1, str2, len1))
56
55static void 57static void
56_edje_format_reparse(Edje_File *edf, const char *str, Edje_Style_Tag *tag_ret, Eina_Strbuf *result) 58_edje_format_reparse(Edje_File *edf, const char *str, Edje_Style_Tag *tag_ret, Eina_Strbuf *result)
57{ 59{
@@ -68,11 +70,11 @@ _edje_format_reparse(Edje_File *edf, const char *str, Edje_Style_Tag *tag_ret, E
68 const char *key = item; 70 const char *key = item;
69 const char *val = pos + 1; 71 const char *val = pos + 1;
70 72
71 if (!strncmp(key, "font_source", key_len)) 73 if (_IS_STRINGS_EQUAL(key, key_len, "font_source", 11))
72 { 74 {
73 /* dont allow font sources */ 75 /* dont allow font sources */
74 } 76 }
75 else if (!strncmp(key, "text_class", key_len)) 77 else if (_IS_STRINGS_EQUAL(key, key_len, "text_class", 10))
76 { 78 {
77 if (tag_ret) 79 if (tag_ret)
78 tag_ret->text_class = eina_stringshare_add(val); 80 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
83 free(item); 85 free(item);
84 continue; 86 continue;
85 } 87 }
86 else if (!strncmp(key, "font_size", key_len)) 88 else if (_IS_STRINGS_EQUAL(key, key_len, "font_size", 9))
87 { 89 {
88 if (tag_ret) 90 if (tag_ret)
89 tag_ret->font_size = atof(val); 91 tag_ret->font_size = atof(val);
90 } 92 }
91 else if (!strncmp(key, "font", key_len)) /* Fix fonts */ 93 else if (_IS_STRINGS_EQUAL(key, key_len, "font", 4)) /* Fix fonts */
92 { 94 {
93 if (tag_ret) 95 if (tag_ret)
94 { 96 {