Author: chromatic
Date: Fri Dec 26 12:15:09 2008
New Revision: 34399

Modified:
   trunk/src/io.c

Log:
[IO] When extending a STRING's buffer in Parrot_io_make_string(), use
Parrot_reallocate_string() instead of Parrot_allocate_string(), so as not to
lose existing contents of the buffer.  See TT #52, filed by Bob Rogers.

Modified: trunk/src/io.c
==============================================================================
--- trunk/src/io.c      (original)
+++ trunk/src/io.c      Fri Dec 26 12:15:09 2008
@@ -158,9 +158,7 @@
 STRING *
 Parrot_io_make_string(PARROT_INTERP, ARGMOD(STRING **buf), size_t len)
 {
-    /*
-     * when we get a NULL string, we read a default len
-     */
+    /* when we get a NULL string, we read a default len */
     if (*buf == NULL) {
         *buf = string_make_empty(interp, enum_stringrep_one, len);
         return *buf;
@@ -168,7 +166,7 @@
     else {
         STRING *s = *buf;
         if (s->bufused < len)
-            Parrot_allocate_string(interp, s, len);
+            Parrot_reallocate_string(interp, s, len);
         return s;
     }
 }

Reply via email to