develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r34399 - trunk/src

From:
chromatic
Date:
December 26, 2008 12:15
Subject:
[svn:parrot] r34399 - trunk/src
Message ID:
20081226201510.B478ACBA12@x12.develooper.com
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;
     }
 }



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About