Leon Brocard (via RT) wrote:

> I have a weird bug where concatenation is sometimes failing, and I
> have no idea why. See the attached pasm. I fully expect both works and
> weird to output "foo", "bar", "quux" with various levels of spacing,
> but weird doesn't output quux.

Patch below should fix the problem. This is not an optimal solution,
as the unmake_COW is probably not required if the string_grow is
going to happen anyway, but it seems to follow the general spirit of
the current code.

-- 
Peter Gibbs
EmKel Systems

Index: string.c
===================================================================
RCS file: /cvs/public/parrot/string.c,v
retrieving revision 1.90
diff -u -r1.90 string.c
--- string.c    23 Aug 2002 07:53:35 -0000      1.90
+++ string.c    30 Aug 2002 16:08:34 -0000
@@ -121,12 +121,12 @@
             b = string_transcode(interpreter, b, a->encoding, a->type,
                                  NULL);
         }
+        unmake_COW(interpreter, a);
         /* make sure A's big enough for both */
         if (a->buflen < a->bufused + b->bufused) {
             a = string_grow(interpreter, a, ((a->bufused + b->bufused)
                             - a->buflen) + EXTRA_SIZE);
         }
-        unmake_COW(interpreter, a);

         /* Tack B on the end of A */
         mem_sys_memcopy((void *)((ptrcast_t)a->strstart + a->bufused),


Reply via email to