> Actually, we don't. (Sez the man catching up on altogether too much > mail) Since we're putting the COW stuff at the tail end, substrings > of COW strings are fine. You set the bufstart to where the substring > starts, buflen set so it goes to the end of the original buffer, and > the string length bit holds the real string length. That way you > start where you need to, but you can still find the COW marker off > the end of the original buffer. > [End quote]
I see one problem with this kind of approach... We have two string headers, A, and B. A points to the second half of string B, and the bufstart points into the middle of B. We start the collection/compacting process. We first find header A, and copy buflen chars after bufstart. We copied half the string. Now header B is traversed, and it can't point to the same memory because only half of the required amount was copied. We could 'fix' this up by including the true buffer length in the buffer footer, so that we ignore the header's buflen during the collection process. But I think the strstart is a better idea regardless. It's what perl5 did anyway, isn't it? Mike Lambert