[svn:parrot] r45639 - trunk/src/io

darbelo at svn.parrot.org darbelo at svn.parrot.org
Tue Apr 13 18:38:03 UTC 2010


Author: darbelo
Date: Tue Apr 13 18:38:01 2010
New Revision: 45639
URL: https://trac.parrot.org/parrot/changeset/45639

Log:
Fold two separate conditionals that did piecemeal string construction into a single API call.

Modified:
   trunk/src/io/buffer.c

Modified: trunk/src/io/buffer.c
==============================================================================
--- trunk/src/io/buffer.c	Tue Apr 13 18:22:11 2010	(r45638)
+++ trunk/src/io/buffer.c	Tue Apr 13 18:38:01 2010	(r45639)
@@ -291,17 +291,11 @@
     if (Parrot_io_get_flags(interp, filehandle) & PIO_F_LINEBUF)
         return Parrot_io_readline_buffer(interp, filehandle, buf);
 
-    if (*buf == NULL) {
-        *buf = Parrot_gc_new_string_header(interp, 0);
-        (*buf)->bufused = len = 2048;
-    }
-
-    s   = *buf;
-    len = s->bufused;
-
-    if (!s->strstart)
-        Parrot_gc_allocate_string_storage(interp, s, len);
+    if (*buf == NULL)
+        *buf = Parrot_str_new_noinit(interp, enum_stringrep_one, 2048);
 
+    s       = *buf;
+    len     = s->bufused;
     out_buf = (unsigned char *)s->strstart;
 
     /* read Data from buffer */


More information about the parrot-commits mailing list