At 12:25 PM +0200 4/19/02, Peter Gibbs wrote: >Mike Lambert wrote: >> Undoing the patch in resources.c seems to fix the problem. >> >> Changing: >> ((Buffer *)buffer)->buflen = req_size; >> to: >> ((Buffer *)buffer)->buflen = size; >> makes it work again. > >Just for interest, the problem here is that the rounding is always up to the >next multiple of 16. So, for example, a zero-length string would have buflen >set to 16 (actually it is set back to zero in string_make, but that just >slows the process down slightly); string_copy would ask for a buffer of 16 >and get back a buffer of 32, etc, so every time a string is copied, it grows >by 16 bytes.
That's not true. Since we're copying and allocating based on the original length, we're not going to grow. However, the point is well-taken--having a version that allocates and returns the real length in the buffer's useful for strings. I'm going to add one in a minute here. >This effect is exacerbated by the fact that "set S1, S2" does a >string_copy - I am still not sure what is supposed to happen here; I believe >that the pure set opcode should just be doing a register copy?? There is a >clone opcode which also does a string_copy, which seems reasonable. set S0, S1 is broken. I'm fixing that now. -- Dan --------------------------------------"it's like this"------------------- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk