From 2244bc0a31b7ac9726383027a1ab66e99cbcfddc Mon Sep 17 00:00:00 2001 From: tasn Date: Wed, 27 Apr 2011 14:59:22 +0000 Subject: [PATCH] Evas textblock: Use strncmp instead of strncpy and strcmp. git-svn-id: http://svn.enlightenment.org/svn/e/trunk/evas@58963 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/canvas/evas_object_textblock.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/lib/canvas/evas_object_textblock.c b/src/lib/canvas/evas_object_textblock.c index bd9a006..229b5fc 100644 --- a/src/lib/canvas/evas_object_textblock.c +++ b/src/lib/canvas/evas_object_textblock.c @@ -5532,17 +5532,14 @@ _evas_textblock_format_is_visible(const char *s) } while ((item = _format_parse(&s))) { - char *tmp; - tmp = alloca(s - item + 1); - strncpy(tmp, item, s - item); - tmp[s - item] = '\0'; + int itlen = s - item; /* We care about all of the formats even after a - except for * item which we don't care after a - because it's just a standard * closing */ - if (((!strcmp(item, "\n")) || (!strcmp(item, "\\n"))) || - ((!strcmp(item, "\t")) || (!strcmp(item, "\\t"))) || - (!strcmp(item, "ps")) || - (!strncmp(item, "item", 4) && is_opener)) /*FIXME: formats like item2 will break it. */ + if ((!strncmp(item, "\n", itlen) || !strncmp(item, "\\n", itlen)) || + (!strncmp(item, "\t", itlen) || !strncmp(item, "\\t", itlen)) || + !strncmp(item, "ps", itlen) || + (!strncmp(item, "item", itlen) && is_opener)) return EINA_TRUE; } return EINA_FALSE; -- 2.7.4