Evas textblock: Use strncmp instead of strncpy and strcmp.
authortasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 27 Apr 2011 14:59:22 +0000 (14:59 +0000)
committertasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 27 Apr 2011 14:59:22 +0000 (14:59 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@58963 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/canvas/evas_object_textblock.c

index bd9a006..229b5fc 100644 (file)
@@ -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;