Fix obscure obstack bug
Neil Booth
neil@daikokuya.demon.co.uk
Sun Sep 16 23:38:00 GMT 2001
DJ Delorie wrote:-
>
> What about if the allocator actually *allocates* a larger chunk the
> first time? In that case, you *would* want to use h->chunk_size.
> Perhaps the user-defined allocator must guarantee that h->chunk_size
> and the initial allocation agree?
I think it's counterintuitive if you allocate a size other than that
requested.
Note my patch only fixes the initial allocation - all subsequent
allocations are handled by different code in obstack.c that does not
have the bug; and does not use h->chunk_size after calling the
allocation routine. So the patch is also making obstack.c internally
self-consistent.
Neil.
More information about the Libc-alpha
mailing list