Evas textblock: ifdef unused 'hyphens' code
authorDaniel Hirt <daniel.hirt@samsung.com>
Sun, 14 Feb 2016 12:20:34 +0000 (14:20 +0200)
committerDaniel Hirt <daniel.hirt@samsung.com>
Sun, 14 Feb 2016 13:46:23 +0000 (15:46 +0200)
The usage of the 'hyphens' array is only relevant when
"--enable-hyphen" is used.
This fixes the dead code addressed in
5b083ace84ca91496810cd1826c9469a6c741700.

src/lib/evas/canvas/evas_object_textblock.c

index 841918b..79e6754 100644 (file)
@@ -4537,13 +4537,14 @@ _layout_get_hyphenationwrap(Ctxt *c, Evas_Object_Textblock_Format *fmt,
 
                   if (word_len >= 4)
                     {
-                       char *hyphens = NULL;
                        size_t hyphen_off;
                        size_t i = 0;
                        size_t pos = 0;
 
 #ifdef HAVE_HYPHEN
-                       hyphens = _layout_wrap_hyphens_get(str, it->format->font.fdesc->lang, word_start, word_len);
+                       char *hyphens = _layout_wrap_hyphens_get(
+                             str, it->format->font.fdesc->lang,
+                             word_start, word_len);
 #endif
 
                        /* This only happens one time, if the cutoff is in
@@ -4563,18 +4564,23 @@ _layout_get_hyphenationwrap(Ctxt *c, Evas_Object_Textblock_Format *fmt,
 
                        for (i = hyphen_off, pos = word_end ; pos > word_start ; i--, pos--)
                          {
-                            if ((hyphens && (hyphens[i] & 1)) || str[pos] == SHY_HYPHEN)
+                            if (
+#ifdef HAVE_HYPHEN
+                                  (hyphens && (hyphens[i] & 1)) ||
+#endif
+                                  (str[pos] == SHY_HYPHEN))
                               {
                                  found_hyphen = EINA_TRUE;
                                  break;
                               }
                          }
 
+#ifdef HAVE_HYPHEN
                        if (hyphens)
                          {
                             free(hyphens);
-                            hyphens = NULL;
                          }
+#endif
 
                        /* Rejecting sequences smaller than 2 characters.
                         * This also works with 'i' initialized to 0 */