]> git.ipfire.org Git - thirdparty/newt.git/commitdiff
may be alright... strncat in dietlibc borked (sorry for the slander msw)
authorewt <ewt>
Tue, 30 Oct 2001 01:18:29 +0000 (01:18 +0000)
committerewt <ewt>
Tue, 30 Oct 2001 01:18:29 +0000 (01:18 +0000)
textbox.c

index 06fa47c754a513d294af8c70182828c3f19bbe4c..dc42dc558f77bc2ead32a6aee872e286fa929904 100644 (file)
--- a/textbox.c
+++ b/textbox.c
@@ -159,8 +159,8 @@ static void doReflow(const char * text, char ** resultPtr, int width,
     int kanji = 0;
 
     if (resultPtr) {
-       /* worst case is a \n after every character */
-       result = malloc((strlen(text) * 2) + 1);
+       /* XXX I think this will work */
+       result = malloc(strlen(text) + (strlen(text) / width) + 2);
        *result = '\0';
     }
     
@@ -227,8 +227,6 @@ static void doReflow(const char * text, char ** resultPtr, int width,
        }
     }
 
-    result = realloc(result, strlen(result) + 1);
-
     if (badness) *badness = howbad;
     if (resultPtr) *resultPtr = result;
     if (heightPtr) *heightPtr = height;