On Thu, 2 Aug 2001, Bill Stoddard wrote: > Fix 1... Pass the entire bucket to the destroy function and let > destroy free the bucket right before return. > #define apr_bucket_destroy(e) do { \ > e->type->destroy(e); \ /* e is freed in destroy() */ > } while(0) > > One irritation with this method is that the destroy() function is > called internal in many of the bucket functions (search for > file_destroy() in apr_bucket_file to see what I mean).
That's the whole problem, yeah. -1. > Fix 2 Define a new field in the generic bucket structure, a pointer to > a function to free the bucket. For example: > #define apr_bucket_destroy(e) do { \ > e->type->destroy(e->data); \ > e->type->free(e); \ > } while(0) > > This requires each bucket implement a free() function. > > Any strong opinions on which way to go (or suggestions for an entirely > different solution)? I'll implement whichever one the group decides > on. +0.9 It should be really easy, in fact... just stick free itself in for that function pointer in all currently implemented bucket types. No need to implement anything. However: once we switch buckets to use SMS, none of this will really be necessary... s/free/apr_sms_free/ in the apr_bucket_destroy() macro, and then SMS handles the polymorphism for you. Just a thought. --Cliff -------------------------------------------------------------- Cliff Woolley [EMAIL PROTECTED] Charlottesville, VA