apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cliff Woolley <cliffwool...@yahoo.com>
Subject Re: apr_bucket_alloc prototype
Date Tue, 25 Sep 2001 04:52:17 GMT
On Mon, 24 Sep 2001, Ryan Bloom wrote:

> > void apr_bucket_free(void *ptr, int list);
> >
> > But that means it'll be tricky to support the b->free(b) thing that
> > FirstBill requested.  It was nice and clean with SMS (grumble), since the
> > function to use and the particular instance to be freed (and knowledge of
> > its parent) were tied together as b->sms... any ideas?  I suppose we could
> > wrap free() with some other function in order to discard the extra
> > parameter for those bucket types that might still want to use malloc/free
> > directly... ugh.
> Why not just put the list number in the bucket itself?

It already is.  It's also in the apr_bucket_file/mmap/etc's so that
file_destroy, mmap_destroy, etc, can work.  Remember that I'm trying to
use apr_bucket_alloc and apr_bucket_free to handle the
apr_bucket_file/mmap/etc's as well as just the apr_bucket's.  So unless
the list number is at the same offset in apr_bucket_file and
apr_bucket_mmap et al as it is in apr_bucket (which it almost certainly
won't be), you can't just do this:

void apr_bucket_free(void *ptr) {
    apr_bucket *b = ptr;
    free_the_damned_thing(b, b->list);

Because b->list will point to the wrong spot in the thing pointed to by


   Cliff Woolley
   Charlottesville, VA

View raw message