You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by jw...@apache.org on 2001/09/23 00:36:07 UTC

cvs commit: apr-util/include apr_buckets.h

jwoolley    01/09/22 15:36:07

  Modified:    buckets  apr_buckets.c apr_buckets_eos.c apr_buckets_file.c
                        apr_buckets_flush.c apr_buckets_heap.c
                        apr_buckets_mmap.c apr_buckets_pipe.c
                        apr_buckets_pool.c apr_buckets_simple.c
                        apr_buckets_socket.c
               include  apr_buckets.h
  Log:
  revert buckets sms phase 1 patch. the group wants to get rid of SMS, so
  the buckets can't use it.  I'll implement a free-list scheme private
  to the buckets next.  in the meanwhile we're back to using malloc/free
  directly instead of via the std sms.
  
  Revision  Changes    Path
  1.54      +0 -2      apr-util/buckets/apr_buckets.c
  
  Index: apr_buckets.c
  ===================================================================
  RCS file: /home/cvs/apr-util/buckets/apr_buckets.c,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -d -u -r1.53 -r1.54
  --- apr_buckets.c	2001/08/25 22:54:56	1.53
  +++ apr_buckets.c	2001/09/22 22:36:07	1.54
  @@ -54,8 +54,6 @@
   
   #include "apr_buckets.h"
   
  -APU_DECLARE_DATA apr_sms_t *apr_bucket_global_sms = NULL;
  -
   APU_DECLARE_NONSTD(apr_status_t) apr_bucket_setaside_noop(apr_bucket *data,
                                                             apr_pool_t *pool)
   {
  
  
  
  1.30      +3 -8      apr-util/buckets/apr_buckets_eos.c
  
  Index: apr_buckets_eos.c
  ===================================================================
  RCS file: /home/cvs/apr-util/buckets/apr_buckets_eos.c,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -d -u -r1.29 -r1.30
  --- apr_buckets_eos.c	2001/08/25 22:54:56	1.29
  +++ apr_buckets_eos.c	2001/09/22 22:36:07	1.30
  @@ -53,6 +53,7 @@
    */
   
   #include "apr_buckets.h"
  +#include <stdlib.h>
   
   static apr_status_t eos_read(apr_bucket *b, const char **str, 
                                   apr_size_t *len, apr_read_type_e block)
  @@ -80,16 +81,10 @@
   
   APU_DECLARE(apr_bucket *) apr_bucket_eos_create(void)
   {
  -    apr_sms_t *sms;
  -    apr_bucket *b;
  +    apr_bucket *b = (apr_bucket *)malloc(sizeof(*b));
   
  -    if (!apr_bucket_global_sms) {
  -        apr_sms_std_create(&apr_bucket_global_sms);
  -    }
  -    sms = apr_bucket_global_sms;
  -    b = (apr_bucket *)apr_sms_malloc(sms, sizeof(*b));
       APR_BUCKET_INIT(b);
  -    b->sms = sms;
  +    b->free = free;
       return apr_bucket_eos_make(b);
   }
   
  
  
  
  1.56      +11 -17    apr-util/buckets/apr_buckets_file.c
  
  Index: apr_buckets_file.c
  ===================================================================
  RCS file: /home/cvs/apr-util/buckets/apr_buckets_file.c,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -d -u -r1.55 -r1.56
  --- apr_buckets_file.c	2001/08/25 22:54:56	1.55
  +++ apr_buckets_file.c	2001/09/22 22:36:07	1.56
  @@ -85,12 +85,10 @@
   
   static void file_destroy(void *data)
   {
  -    apr_bucket_file *f = data;
  -
  -    if (apr_bucket_shared_destroy(f)) {
  +    if (apr_bucket_shared_destroy(data)) {
           /* no need to close the file here; it will get
            * done automatically when the pool gets cleaned up */
  -        apr_sms_free(f->sms, f);
  +        free(data);
       }
   }
   
  @@ -188,12 +186,12 @@
       if (filelength > 0) {
           /* for efficiency, we can just build a new apr_bucket struct
            * to wrap around the existing file bucket */
  -        b = (apr_bucket *)apr_sms_malloc(e->sms, sizeof(*b));
  +        b = malloc(sizeof(*b));
           b->start  = fileoffset + (*len);
           b->length = filelength;
           b->data   = a;
           b->type   = &apr_bucket_type_file;
  -        b->sms    = e->sms;
  +        b->free   = free;
           APR_BUCKET_INSERT_AFTER(e, b);
       }
       else {
  @@ -210,12 +208,14 @@
   {
       apr_bucket_file *f;
   
  -    f = (apr_bucket_file *)apr_sms_malloc(b->sms, sizeof(*f));
  +    f = malloc(sizeof(*f));
  +    if (f == NULL) {
  +        return NULL;
  +    }
       f->fd = fd;
       f->readpool = p;
  -    f->sms = b->sms;
   
  -    apr_bucket_shared_make(b, f, offset, len);
  +    b = apr_bucket_shared_make(b, f, offset, len);
       b->type = &apr_bucket_type_file;
   
       return b;
  @@ -225,16 +225,10 @@
                                                    apr_off_t offset,
                                                    apr_size_t len, apr_pool_t *p)
   {
  -    apr_sms_t *sms;
  -    apr_bucket *b;
  +    apr_bucket *b = (apr_bucket *)malloc(sizeof(*b));
   
  -    if (!apr_bucket_global_sms) {
  -        apr_sms_std_create(&apr_bucket_global_sms);
  -    }
  -    sms = apr_bucket_global_sms;
  -    b = (apr_bucket *)apr_sms_malloc(sms, sizeof(*b));
       APR_BUCKET_INIT(b);
  -    b->sms = sms;
  +    b->free = free;
       return apr_bucket_file_make(b, fd, offset, len, p);
   }
   
  
  
  
  1.22      +3 -8      apr-util/buckets/apr_buckets_flush.c
  
  Index: apr_buckets_flush.c
  ===================================================================
  RCS file: /home/cvs/apr-util/buckets/apr_buckets_flush.c,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -d -u -r1.21 -r1.22
  --- apr_buckets_flush.c	2001/08/25 22:54:56	1.21
  +++ apr_buckets_flush.c	2001/09/22 22:36:07	1.22
  @@ -53,6 +53,7 @@
    */
   
   #include "apr_buckets.h"
  +#include <stdlib.h>
   
   static apr_status_t flush_read(apr_bucket *b, const char **str, 
                                   apr_size_t *len, apr_read_type_e block)
  @@ -80,16 +81,10 @@
   
   APU_DECLARE(apr_bucket *) apr_bucket_flush_create(void)
   {
  -    apr_sms_t *sms;
  -    apr_bucket *b;
  +    apr_bucket *b = (apr_bucket *)malloc(sizeof(*b));
   
  -    if (!apr_bucket_global_sms) {
  -        apr_sms_std_create(&apr_bucket_global_sms);
  -    }
  -    sms = apr_bucket_global_sms;
  -    b = (apr_bucket *)apr_sms_malloc(sms, sizeof(*b));
       APR_BUCKET_INIT(b);
  -    b->sms = sms;
  +    b->free = free;
       return apr_bucket_flush_make(b);
   }
   
  
  
  
  1.38      +12 -13    apr-util/buckets/apr_buckets_heap.c
  
  Index: apr_buckets_heap.c
  ===================================================================
  RCS file: /home/cvs/apr-util/buckets/apr_buckets_heap.c,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -d -u -r1.37 -r1.38
  --- apr_buckets_heap.c	2001/08/25 22:54:56	1.37
  +++ apr_buckets_heap.c	2001/09/22 22:36:07	1.38
  @@ -74,7 +74,7 @@
   
       if (apr_bucket_shared_destroy(h)) {
           free(h->base);
  -        apr_sms_free(h->sms, h);
  +        free(h);
       }
   }
   
  @@ -83,11 +83,18 @@
   {
       apr_bucket_heap *h;
   
  -    h = (apr_bucket_heap *)apr_sms_malloc(b->sms, sizeof(*h));
  +    h = malloc(sizeof(*h));
  +    if (h == NULL) {
  +	return NULL;
  +    }
   
       if (copy) {
   	h->alloc_len = length;
   	h->base = malloc(h->alloc_len);
  +	if (h->base == NULL) {
  +	    free(h);
  +	    return NULL;
  +	}
   	memcpy(h->base, buf, length);
       }
       else {
  @@ -97,12 +104,10 @@
   	h->base = (char *) buf;
   	h->alloc_len = length;
       }
  -    h->sms = b->sms;
   
  -    apr_bucket_shared_make(b, h, 0, length);
  +    b = apr_bucket_shared_make(b, h, 0, length);
       b->type = &apr_bucket_type_heap;
   
  -    /* XXX: the w parm is useless and should go away */
       if (w)
           *w = length;
   
  @@ -112,16 +117,10 @@
   APU_DECLARE(apr_bucket *) apr_bucket_heap_create(
   		const char *buf, apr_size_t length, int copy, apr_size_t *w)
   {
  -    apr_sms_t *sms;
  -    apr_bucket *b;
  +    apr_bucket *b = (apr_bucket *)malloc(sizeof(*b));
   
  -    if (!apr_bucket_global_sms) {
  -        apr_sms_std_create(&apr_bucket_global_sms);
  -    }
  -    sms = apr_bucket_global_sms;
  -    b = (apr_bucket *)apr_sms_malloc(sms, sizeof(*b));
       APR_BUCKET_INIT(b);
  -    b->sms = sms;
  +    b->free = free;
       return apr_bucket_heap_make(b, buf, length, copy, w);
   }
   
  
  
  
  1.43      +11 -14    apr-util/buckets/apr_buckets_mmap.c
  
  Index: apr_buckets_mmap.c
  ===================================================================
  RCS file: /home/cvs/apr-util/buckets/apr_buckets_mmap.c,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -d -u -r1.42 -r1.43
  --- apr_buckets_mmap.c	2001/08/25 22:54:56	1.42
  +++ apr_buckets_mmap.c	2001/09/22 22:36:07	1.43
  @@ -55,6 +55,7 @@
   #include "apr_buckets.h"
   #define APR_WANT_MEMFUNC
   #include "apr_want.h"
  +#include <stdlib.h>
   
   #if APR_HAS_MMAP
   
  @@ -81,7 +82,7 @@
       if (apr_bucket_shared_destroy(m)) {
           /* no need to apr_mmap_delete(m->mmap) here... it will
            * get done automatically when the pool gets cleaned up. */
  -        apr_sms_free(m->sms, m);
  +        free(m);
       }
   }
   
  @@ -93,12 +94,14 @@
   {
       apr_bucket_mmap *m;
   
  -    m = (apr_bucket_mmap *)apr_sms_malloc(b->sms, sizeof(*m));
  +    m = malloc(sizeof(*m));
  +    if (m == NULL) {
  +	return NULL;
  +    }
       m->mmap = mm;
  -    m->sms = b->sms;
   
  -    apr_bucket_shared_make(b, m, start, length);
  -    b->type = &apr_bucket_type_mmap;
  +    b = apr_bucket_shared_make(b, m, start, length);
  +    b->type     = &apr_bucket_type_mmap;
   
       return b;
   }
  @@ -107,16 +110,10 @@
   APU_DECLARE(apr_bucket *) apr_bucket_mmap_create(
   		apr_mmap_t *mm, apr_off_t start, apr_size_t length)
   {
  -    apr_sms_t *sms;
  -    apr_bucket *b;
  +    apr_bucket *b = (apr_bucket *)malloc(sizeof(*b));
   
  -    if (!apr_bucket_global_sms) {
  -        apr_sms_std_create(&apr_bucket_global_sms);
  -    }
  -    sms = apr_bucket_global_sms;
  -    b = (apr_bucket *)apr_sms_malloc(sms, sizeof(*b));
       APR_BUCKET_INIT(b);
  -    b->sms = sms;
  +    b->free = free;
       return apr_bucket_mmap_make(b, mm, start, length);
   }
   
  @@ -139,7 +136,7 @@
   
       base = apr_palloc(p, data->length);
       memcpy(base, addr, data->length);
  -    apr_bucket_pool_make(data, base, data->length, p);
  +    data = apr_bucket_pool_make(data, base, data->length, p);
       mmap_destroy(m);
   
       return APR_SUCCESS;
  
  
  
  1.41      +7 -12     apr-util/buckets/apr_buckets_pipe.c
  
  Index: apr_buckets_pipe.c
  ===================================================================
  RCS file: /home/cvs/apr-util/buckets/apr_buckets_pipe.c,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -d -u -r1.40 -r1.41
  --- apr_buckets_pipe.c	2001/08/25 22:54:56	1.40
  +++ apr_buckets_pipe.c	2001/09/22 22:36:07	1.41
  @@ -70,7 +70,7 @@
   
       *str = NULL;
       *len = APR_BUCKET_BUFF_SIZE;
  -    buf = malloc(*len);
  +    buf = malloc(*len); /* XXX: check for failure? */
   
       rv = apr_file_read(p, buf, len);
   
  @@ -96,8 +96,9 @@
        */
       if (*len > 0) {
           apr_bucket_heap *h;
  -
  -        apr_bucket_heap_make(a, buf, *len, 0, NULL);
  +        /* Change the current bucket to refer to what we read */
  +        /* XXX: check for failure? */
  +        a = apr_bucket_heap_make(a, buf, *len, 0, NULL);
           h = a->data;
           h->alloc_len = APR_BUCKET_BUFF_SIZE; /* note the real buffer size */
           *str = buf;
  @@ -105,7 +106,7 @@
       }
       else {
           free(buf);
  -        apr_bucket_immortal_make(a, "", 0);
  +        a = apr_bucket_immortal_make(a, "", 0);
           *str = a->data;
           if (rv == APR_EOF) {
               apr_file_close(p);
  @@ -143,16 +144,10 @@
   
   APU_DECLARE(apr_bucket *) apr_bucket_pipe_create(apr_file_t *p)
   {
  -    apr_sms_t *sms;
  -    apr_bucket *b;
  +    apr_bucket *b = (apr_bucket *)malloc(sizeof(*b));
   
  -    if (!apr_bucket_global_sms) {
  -        apr_sms_std_create(&apr_bucket_global_sms);
  -    }
  -    sms = apr_bucket_global_sms;
  -    b = (apr_bucket *)apr_sms_malloc(sms, sizeof(*b));
       APR_BUCKET_INIT(b);
  -    b->sms = sms;
  +    b->free = free;
       return apr_bucket_pipe_make(b, p);
   }
   
  
  
  
  1.24      +8 -12     apr-util/buckets/apr_buckets_pool.c
  
  Index: apr_buckets_pool.c
  ===================================================================
  RCS file: /home/cvs/apr-util/buckets/apr_buckets_pool.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -d -u -r1.23 -r1.24
  --- apr_buckets_pool.c	2001/08/25 22:54:56	1.23
  +++ apr_buckets_pool.c	2001/09/22 22:36:07	1.24
  @@ -116,7 +116,7 @@
            */
           if (apr_bucket_shared_destroy(p)) {
               apr_pool_cleanup_kill(p->pool, p, pool_bucket_cleanup);
  -            apr_sms_free(p->heap.sms, p);
  +            free(p);
           }
       }
       else {
  @@ -134,7 +134,10 @@
   {
       apr_bucket_pool *p;
   
  -    p = (apr_bucket_pool *)apr_sms_malloc(b->sms, sizeof(*p));
  +    p = malloc(sizeof(*p));
  +    if (p == NULL) {
  +	return NULL;
  +    }
   
       /* XXX: we lose the const qualifier here which indicates
        * there's something screwy with the API...
  @@ -144,13 +147,12 @@
       p->base = (char *) buf;
       p->pool = pool;
   
  -    apr_bucket_shared_make(b, p, 0, length);
  +    b = apr_bucket_shared_make(b, p, 0, length);
       b->type = &apr_bucket_type_pool;
   
       /* pre-initialize heap bucket member */
       p->heap.alloc_len = length;
       p->heap.base      = NULL;
  -    p->heap.sms       = b->sms;
   
       apr_pool_cleanup_register(p->pool, p, pool_bucket_cleanup,
                                 apr_pool_cleanup_null);
  @@ -160,16 +162,10 @@
   APU_DECLARE(apr_bucket *) apr_bucket_pool_create(
   		const char *buf, apr_size_t length, apr_pool_t *pool)
   {
  -    apr_sms_t *sms;
  -    apr_bucket *b;
  +    apr_bucket *b = (apr_bucket *)malloc(sizeof(*b));
   
  -    if (!apr_bucket_global_sms) {
  -        apr_sms_std_create(&apr_bucket_global_sms);
  -    }
  -    sms = apr_bucket_global_sms;
  -    b = (apr_bucket *)apr_sms_malloc(sms, sizeof(*b));
       APR_BUCKET_INIT(b);
  -    b->sms = sms;
  +    b->free = free;
       return apr_bucket_pool_make(b, buf, length, pool);
   }
   
  
  
  
  1.35      +13 -18    apr-util/buckets/apr_buckets_simple.c
  
  Index: apr_buckets_simple.c
  ===================================================================
  RCS file: /home/cvs/apr-util/buckets/apr_buckets_simple.c,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -d -u -r1.34 -r1.35
  --- apr_buckets_simple.c	2001/08/25 23:05:52	1.34
  +++ apr_buckets_simple.c	2001/09/22 22:36:07	1.35
  @@ -53,11 +53,14 @@
    */
   
   #include "apr_buckets.h"
  +#include <stdlib.h>
   
   APU_DECLARE_NONSTD(apr_status_t) apr_bucket_simple_copy(apr_bucket *a,
                                                           apr_bucket **b)
   {
  -    *b = (apr_bucket *)apr_sms_malloc(a->sms, sizeof(**b));
  +    if ((*b = malloc(sizeof(**b))) == NULL) {
  +	return APR_ENOMEM;
  +    }
       **b = *a;
   
       return APR_SUCCESS;
  @@ -98,22 +101,17 @@
       b->length = length;
       b->start  = 0;
       b->type   = &apr_bucket_type_immortal;
  +
       return b;
   }
   
   APU_DECLARE(apr_bucket *) apr_bucket_immortal_create(
   		const char *buf, apr_size_t length)
   {
  -    apr_sms_t *sms;
  -    apr_bucket *b;
  +    apr_bucket *b = (apr_bucket *)malloc(sizeof(*b));
   
  -    if (!apr_bucket_global_sms) {
  -        apr_sms_std_create(&apr_bucket_global_sms);
  -    }
  -    sms = apr_bucket_global_sms;
  -    b = (apr_bucket *)apr_sms_malloc(sms, sizeof(*b));
       APR_BUCKET_INIT(b);
  -    b->sms = sms;
  +    b->free = free;
       return apr_bucket_immortal_make(b, buf, length);
   }
   
  @@ -128,7 +126,10 @@
    */
   static apr_status_t transient_setaside(apr_bucket *b, apr_pool_t *pool)
   {
  -    apr_bucket_heap_make(b, (char *)b->data + b->start, b->length, 1, NULL);
  +    b = apr_bucket_heap_make(b, (char *)b->data + b->start, b->length, 1, NULL);
  +    if (b == NULL) {
  +        return APR_ENOMEM;
  +    }
       return APR_SUCCESS;
   }
   
  @@ -145,16 +146,10 @@
   APU_DECLARE(apr_bucket *) apr_bucket_transient_create(
   		const char *buf, apr_size_t length)
   {
  -    apr_sms_t *sms;
  -    apr_bucket *b;
  +    apr_bucket *b = (apr_bucket *)malloc(sizeof(*b));
   
  -    if (!apr_bucket_global_sms) {
  -        apr_sms_std_create(&apr_bucket_global_sms);
  -    }
  -    sms = apr_bucket_global_sms;
  -    b = (apr_bucket *)apr_sms_malloc(sms, sizeof(*b));
       APR_BUCKET_INIT(b);
  -    b->sms = sms;
  +    b->free = free;
       return apr_bucket_transient_make(b, buf, length);
   }
   
  
  
  
  1.30      +7 -12     apr-util/buckets/apr_buckets_socket.c
  
  Index: apr_buckets_socket.c
  ===================================================================
  RCS file: /home/cvs/apr-util/buckets/apr_buckets_socket.c,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -d -u -r1.29 -r1.30
  --- apr_buckets_socket.c	2001/08/25 22:54:56	1.29
  +++ apr_buckets_socket.c	2001/09/22 22:36:07	1.30
  @@ -70,7 +70,7 @@
   
       *str = NULL;
       *len = APR_BUCKET_BUFF_SIZE;
  -    buf = malloc(*len);
  +    buf = malloc(*len); /* XXX: check for failure? */
   
       rv = apr_recv(p, buf, len);
   
  @@ -99,8 +99,9 @@
        */
       if (*len > 0) {
           apr_bucket_heap *h;
  -
  -        apr_bucket_heap_make(a, buf, *len, 0, NULL);
  +        /* Change the current bucket to refer to what we read */
  +        /* XXX: check for failure? */
  +        a = apr_bucket_heap_make(a, buf, *len, 0, NULL);
           h = a->data;
           h->alloc_len = APR_BUCKET_BUFF_SIZE; /* note the real buffer size */
           *str = buf;
  @@ -108,7 +109,7 @@
       }
       else {
           free(buf);
  -        apr_bucket_immortal_make(a, "", 0);
  +        a = apr_bucket_immortal_make(a, "", 0);
           *str = a->data;
           if (rv == APR_EOF && block == APR_NONBLOCK_READ) {
               /* XXX: this is bogus... should return APR_SUCCESS */
  @@ -138,16 +139,10 @@
   
   APU_DECLARE(apr_bucket *) apr_bucket_socket_create(apr_socket_t *p)
   {
  -    apr_sms_t *sms;
  -    apr_bucket *b;
  +    apr_bucket *b = (apr_bucket *)malloc(sizeof(*b));
   
  -    if (!apr_bucket_global_sms) {
  -        apr_sms_std_create(&apr_bucket_global_sms);
  -    }
  -    sms = apr_bucket_global_sms;
  -    b = (apr_bucket *)apr_sms_malloc(sms, sizeof(*b));
       APR_BUCKET_INIT(b);
  -    b->sms = sms;
  +    b->free = free;
       return apr_bucket_socket_make(b, p);
   }
   
  
  
  
  1.118     +10 -17    apr-util/include/apr_buckets.h
  
  Index: apr_buckets.h
  ===================================================================
  RCS file: /home/cvs/apr-util/include/apr_buckets.h,v
  retrieving revision 1.117
  retrieving revision 1.118
  diff -u -d -u -r1.117 -r1.118
  --- apr_buckets.h	2001/09/09 05:54:35	1.117
  +++ apr_buckets.h	2001/09/22 22:36:07	1.118
  @@ -60,14 +60,13 @@
   #define APR_BUCKETS_H
   
   #include "apu.h"
  -#include "apr.h"
   #include "apr_network_io.h"
   #include "apr_file_io.h"
   #include "apr_general.h"
   #include "apr_mmap.h"
   #include "apr_errno.h"
   #include "apr_ring.h"
  -#include "apr_sms.h"
  +#include "apr.h"
   #if APR_HAVE_SYS_UIO_H
   #include <sys/uio.h>	/* for struct iovec */
   #endif
  @@ -224,8 +223,8 @@
   };
   
   /**
  - * apr_bucket structures are allocated from an SMS with apr_sms_malloc()
  - * and their lifetime is controlled by the parent apr_bucket_brigade
  + * apr_bucket structures are allocated on the malloc() heap and
  + * their lifetime is controlled by the parent apr_bucket_brigade
    * structure. Buckets can move from one brigade to another e.g. by
    * calling APR_BRIGADE_CONCAT(). In general the data in a bucket has
    * the same lifetime as the bucket and is freed when the bucket is
  @@ -254,10 +253,13 @@
       /** type-dependent data hangs off this pointer */
       void *data;	
       /**
  -     * Pointer to SMS in which bucket is allocated.  Used when freeing
  -     * the bucket and when allocating for private data structures.
  +     * Pointer to function used to free the bucket. This function should
  +     * always be defined and it should be consistent with the memory
  +     * function used to allocate the bucket. For example, if malloc() is 
  +     * used to allocate the bucket, this pointer should point to free().
  +     * @param e Pointer to the bucket being freed
        */
  -    apr_sms_t *sms;
  +    void (*free)(void *e);
   };
   
   /** A list of buckets */
  @@ -279,9 +281,6 @@
       APR_RING_HEAD(apr_bucket_list, apr_bucket) list;
   };
   
  -/* temporary */
  -APU_DECLARE_DATA extern apr_sms_t *apr_bucket_global_sms;
  -
   typedef apr_status_t (*apr_brigade_flush)(apr_bucket_brigade *bb, void *ctx);
   
   /**
  @@ -554,8 +553,6 @@
       char    *base;
       /** how much memory was allocated */
       apr_size_t  alloc_len;
  -    /** The SMS from which this structure was allocated */
  -    apr_sms_t *sms;
   };
   
   typedef struct apr_bucket_pool apr_bucket_pool;
  @@ -600,8 +597,6 @@
       apr_bucket_refcount  refcount;
       /** The mmap this sub_bucket refers to */
       apr_mmap_t *mmap;
  -    /** The SMS from which this structure was allocated */
  -    apr_sms_t *sms;
   };
   #endif
   
  @@ -617,8 +612,6 @@
       /** The pool into which any needed structures should
        *  be created while reading from this file bucket */
       apr_pool_t *readpool;
  -    /** The SMS from which this structure was allocated */
  -    apr_sms_t *sms;
   };
   
   /*  *****  Bucket Brigade Functions  *****  */
  @@ -795,7 +788,7 @@
    */
   #define apr_bucket_destroy(e) do {					\
           (e)->type->destroy((e)->data);					\
  -        apr_sms_free((e)->sms, (e));					\
  +        (e)->free(e);							\
       } while (0)
   
   /**