I wrote: > struct scratch_buffer { > void *data; /* Pointer to the beginning of the scratch area. */ > size_t length; /* Allocated space at the data pointer, in bytes. */ > ... > }; > > it seems quite natural to do pointer arithmetic on 'data'. Namely, this will > happen each time a scratch_buffer gets booked by several (not just one) > pieces of memory.
Oops. scratch_buffer is not appropriate for this kind of use, as it does not contain a 'size_t used;' field (like linebuffer does). I was thinking at a combination between scratch_buffer and the 'alloca_used' logic from glob.c. But this is beyond what scratch_buffer does. Bruno