Author: chromatic
Date: Mon Dec 15 11:28:25 2008
New Revision: 33928

Modified:
   trunk/src/string.c

Log:
[src] Delayed a string copy until absolutely necessary during an inplace chop.

Modified: trunk/src/string.c
==============================================================================
--- trunk/src/string.c  (original)
+++ trunk/src/string.c  Mon Dec 15 11:28:25 2008
@@ -1356,8 +1356,6 @@
     UINTVAL new_length, uchar_size;
     String_iter iter;
 
-    Parrot_unmake_COW(interp, s);
-
     if (n < 0) {
         new_length = -n;
         if (new_length > s->strlen)
@@ -1377,6 +1375,8 @@
         return;
     }
 
+    Parrot_unmake_COW(interp, s);
+
     uchar_size = s->bufused / s->strlen;
     s->strlen  = new_length;
 

Reply via email to