Note that string_grow still has the problem with not bothering to allocate a
new buffer if copysize is zero, e.g. if we are expanding a previously empty
buffer.

I have submitted a patch for this previously, but since string_grow has now
changed, herewith a resynced patch.

--
Peter Gibbs
EmKel Systems

Index: string.c
===================================================================
RCS file: /home/perlcvs/parrot/string.c,v
retrieving revision 1.72
diff -u -r1.72 string.c
--- string.c 15 Apr 2002 20:04:03 -0000 1.72
+++ string.c 15 Apr 2002 20:18:33 -0000
@@ -72,11 +72,6 @@
  */
 STRING *
 string_grow(struct Parrot_Interp * interpreter, STRING * s, INTVAL addlen)
{
-    INTVAL copysize = s->bufused;
-    if(addlen < 0)
-        copysize += addlen;
-    if(copysize <= 0)
-        return s;
     /* Don't check buflen, if we are here, we already checked. */
     Parrot_reallocate(interpreter, s, s->buflen + addlen);
     return s;


Reply via email to