You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rb...@locus.apache.org on 2000/07/18 01:49:57 UTC

cvs commit: apache-2.0/src/lib/apr/buckets ap_buf.c ap_eos_buf.c ap_mmap_buf.c ap_rmem_buf.c ap_rwmem_buf.c apr_buf.h ryan.patch

rbb         00/07/17 16:49:55

  Modified:    src/lib/apr/buckets ap_buf.c ap_eos_buf.c ap_mmap_buf.c
                        ap_rmem_buf.c ap_rwmem_buf.c apr_buf.h ryan.patch
  Log:
  Remove the ap_bucket_list type.  This moves the next/prev pointers down
  to the ap_bucket type.  The reasoning behind the bucket_list was never
  very clear, and there were some annoyming memory leaks caused by keeping
  that type filters.  This also cleans up those memory leaks.  finally, this
  tightens up the API a bit more.
  Submitted by:	Cliff Woolley <jw...@wlu.edu>
  Reviewed by:	Ryan Bloom
  
  Revision  Changes    Path
  1.13      +31 -56    apache-2.0/src/lib/apr/buckets/ap_buf.c
  
  Index: ap_buf.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/buckets/ap_buf.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ap_buf.c	2000/07/14 00:24:33	1.12
  +++ ap_buf.c	2000/07/17 23:49:35	1.13
  @@ -100,12 +100,27 @@
   APR_EXPORT(ap_status_t) ap_bucket_brigade_destroy(void *data)
   {
       ap_bucket_brigade *b = data;
  -    ap_bucket_list *bl = b->head;
   
  -    ap_destroy_bucket_list(bl);
  +    ap_bucket_list_destroy(b->head);
  +    /* The brigade itself is allocated out of a pool, so we don't actually 
  +     * want to free it.  If we did, we would do that free() here.
  +     */
  +
  +    return APR_SUCCESS;
  +}
   
  +APR_EXPORT(ap_status_t) ap_bucket_list_destroy(ap_bucket *e)
  +{
  +    ap_bucket *cur = e;
  +    ap_bucket *next;
  +
  +    while (cur) {
  +        next = cur->next;
  +        ap_bucket_destroy(cur);
  +        cur = next;
  +    }
       return APR_SUCCESS;
  -}        
  +}
   
   APR_EXPORT(ap_bucket_brigade *) ap_bucket_brigade_create(ap_pool_t *p)
   {
  @@ -120,19 +135,11 @@
       return b;
   }
   
  -APR_EXPORT(ap_bucket_list *) ap_bucket_list_create(void)
  +APR_EXPORT(void) ap_bucket_brigade_append_buckets(ap_bucket_brigade *b, 
  +                                                  ap_bucket *e)
   {
  -    ap_bucket_list *b;
  -    
  -    b = calloc(1, sizeof(*b));
  -    return b;
  -}
  +    ap_bucket *cur = e;
   
  -APR_EXPORT(void) ap_bucket_brigade_append_list(ap_bucket_brigade *b, 
  -                                               ap_bucket_list *e)
  -{
  -    ap_bucket_list *cur = e;
  -
       if (b->tail) {
           b->tail->next = e;
           e->prev = b->tail;
  @@ -146,37 +153,17 @@
       }
   }
   
  -APR_EXPORT(void) ap_bucket_brigade_append_bucket(ap_bucket_brigade *b,
  -                                                 ap_bucket *r)
  -{
  -    if (b->tail) {
  -        if (b->tail->bucket == NULL) {
  -            b->tail->bucket = r;
  -        }
  -        else {
  -            b->tail->next = ap_bucket_list_create();
  -            b->tail->next->prev = b->tail;
  -            b->tail = b->tail->next;
  -            b->tail->bucket = r;
  -        }
  -    }
  -    else {
  -        b->head = b->tail = ap_bucket_list_create();
  -        b->tail->bucket = r;
  -    }
  -}
  -
   APR_EXPORT(int) ap_bucket_brigade_to_iovec(ap_bucket_brigade *b, 
                                              struct iovec *vec, int nvec)
   {
  -    ap_bucket_list *e;
  +    ap_bucket *e;
       struct iovec *orig;
   
       orig = vec;
       e = b->head;
       while (e && nvec) {
  -	vec->iov_base = (void *)ap_get_bucket_char_str(e->bucket);
  -	vec->iov_len = ap_get_bucket_len(e->bucket);
  +	vec->iov_base = (void *)ap_get_bucket_char_str(e);
  +	vec->iov_len = ap_get_bucket_len(e);
   	e = e->next;
   	--nvec;
   	++vec;
  @@ -207,12 +194,12 @@
   
       for (i=0; i < nvec; i++) {
           if (b->head == b->tail) {
  -            ap_bucket_destroy(b->head->bucket);
  +            ap_bucket_destroy(b->head);
               b->head = b->tail = NULL;
               break;
           }
           b->head = b->head->next;
  -        ap_bucket_destroy(b->head->prev->bucket);
  +        ap_bucket_destroy(b->head->prev);
           b->head->prev = NULL;
       }
   }
  @@ -241,17 +228,6 @@
       return APR_SUCCESS;
   }
   
  -APR_EXPORT(ap_status_t) ap_destroy_bucket_list(ap_bucket_list *buf)
  -{
  -    ap_bucket_list *dptr = buf;
  -   
  -    while (dptr) {
  -        ap_bucket_destroy(dptr->bucket);
  -        dptr = dptr->next;
  -    }
  -    return APR_SUCCESS;
  -}
  -
   APR_EXPORT(const char *) ap_get_bucket_char_str(ap_bucket *b)
   {
       if (b) {
  @@ -275,10 +251,9 @@
       int j, k, rv;
       ap_ssize_t i;
   
  -    if (b->tail && b->tail->bucket && 
  -        b->tail->bucket->color == AP_BUCKET_rwmem) {
  +    if (b->tail && b->tail->color == AP_BUCKET_rwmem) {
           ap_bucket *rw;
  -        rw = b->tail->bucket;
  +        rw = b->tail;
           /* I have no idea if this is a good idea or not.  Probably not.
            * Basically, if the last bucket in the list is a rwmem bucket,
            * then we just add to it instead of allocating a new read only
  @@ -298,7 +273,7 @@
               }
               k += i;
   
  -            ap_bucket_brigade_append_bucket(b, rw);
  +            ap_bucket_brigade_append_buckets(b, rw);
           }        
       }
       
  @@ -316,7 +291,7 @@
           }
           k += i;
   
  -        ap_bucket_brigade_append_bucket(b, r);
  +        ap_bucket_brigade_append_buckets(b, r);
       }
   
       return k;
  @@ -346,7 +321,7 @@
   
       r = ap_bucket_new(AP_BUCKET_rwmem);
       res = r->insert(r, buf, strlen(buf), &i);
  -    ap_bucket_brigade_append_bucket(b, r);
  +    ap_bucket_brigade_append_buckets(b, r);
   
       return res;
   }
  
  
  
  1.2       +1 -1      apache-2.0/src/lib/apr/buckets/ap_eos_buf.c
  
  Index: ap_eos_buf.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/buckets/ap_eos_buf.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ap_eos_buf.c	2000/07/13 21:48:33	1.1
  +++ ap_eos_buf.c	2000/07/17 23:49:35	1.2
  @@ -73,7 +73,7 @@
   {
       ap_bucket *newbuf;
   
  -    newbuf            = malloc(sizeof(*newbuf));
  +    newbuf            = calloc(1, sizeof(*newbuf));
   
       newbuf->color     = AP_BUCKET_eos;
       newbuf->getstr    = eos_get_str;
  
  
  
  1.5       +1 -1      apache-2.0/src/lib/apr/buckets/ap_mmap_buf.c
  
  Index: ap_mmap_buf.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/buckets/ap_mmap_buf.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ap_mmap_buf.c	2000/07/14 00:24:33	1.4
  +++ ap_mmap_buf.c	2000/07/17 23:49:35	1.5
  @@ -89,7 +89,7 @@
       ap_bucket *newbuf;
       ap_bucket_mmap *b;
   
  -    newbuf            = malloc(sizeof(*newbuf));
  +    newbuf            = calloc(1, sizeof(*newbuf));
       b                 = malloc(sizeof(*b));
   
       b->data      = NULL;
  
  
  
  1.6       +1 -1      apache-2.0/src/lib/apr/buckets/ap_rmem_buf.c
  
  Index: ap_rmem_buf.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/buckets/ap_rmem_buf.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ap_rmem_buf.c	2000/07/14 00:24:33	1.5
  +++ ap_rmem_buf.c	2000/07/17 23:49:35	1.6
  @@ -106,7 +106,7 @@
       ap_bucket *newbuf;
       ap_bucket_rmem *b;
   
  -    newbuf                = malloc(sizeof(*newbuf));
  +    newbuf                = calloc(1, sizeof(*newbuf));
       b                     = malloc(sizeof(*b)); 
   
       b->alloc_len          = 0;
  
  
  
  1.6       +1 -1      apache-2.0/src/lib/apr/buckets/ap_rwmem_buf.c
  
  Index: ap_rwmem_buf.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/buckets/ap_rwmem_buf.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ap_rwmem_buf.c	2000/07/14 00:24:33	1.5
  +++ ap_rwmem_buf.c	2000/07/17 23:49:35	1.6
  @@ -124,7 +124,7 @@
       ap_bucket *newbuf;
       ap_bucket_rwmem *b;
   
  -    newbuf = malloc(sizeof(*newbuf));
  +    newbuf = calloc(1, sizeof(*newbuf));
       b = malloc(sizeof(*b));
       
       b->alloc_addr = calloc(DEFAULT_RWBUF_SIZE, 1);
  
  
  
  1.14      +10 -24    apache-2.0/src/lib/apr/buckets/apr_buf.h
  
  Index: apr_buf.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/buckets/apr_buf.h,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- apr_buf.h	2000/07/14 00:24:33	1.13
  +++ apr_buf.h	2000/07/17 23:49:35	1.14
  @@ -95,15 +95,10 @@
        * into the bucket.
        */ 
       int (*insert)(ap_bucket *e, const void *buf, ap_size_t nbytes, ap_ssize_t *w);
  +    ap_bucket *next;                     /* The next node in the bucket list */
  +    ap_bucket *prev;                     /* The prev node in the bucket list */
   };
   
  -typedef struct ap_bucket_list ap_bucket_list;
  -struct ap_bucket_list {
  -    ap_bucket *bucket;                   /* The bucket */
  -    ap_bucket_list *next;                /* The next node in the bucket list */
  -    ap_bucket_list *prev;                /* The prev node in the bucket list */
  -};
  -
   typedef struct ap_bucket_brigade ap_bucket_brigade;
   struct ap_bucket_brigade {
       ap_pool_t *p;                       /* The pool to associate this with.
  @@ -111,8 +106,8 @@
                                              but this lets me register a cleanup
                                              to put a limit on the brigade's 
                                              lifetime. */
  -    ap_bucket_list *head;               /* The start of the brigade */
  -    ap_bucket_list *tail;               /* The end of the brigade */
  +    ap_bucket *head;                    /* The start of the brigade */
  +    ap_bucket *tail;                    /* The end of the brigade */
   };
   
   /*    ******  Different bucket types   *****/
  @@ -152,13 +147,9 @@
   /* destroy an enitre bucket brigade */
   APR_EXPORT(ap_status_t) ap_bucket_brigade_destroy(void *b);
   
  -/* append a bucket_list to a bucket_brigade */
  -APR_EXPORT(void) ap_bucket_brigade_append_list(ap_bucket_brigade *b, 
  -                                               ap_bucket_list *e);
  -
  -/* append a bucket to a bucket_brigade */
  -APR_EXPORT(void) ap_bucket_brigade_append_bucket(ap_bucket_brigade *b,
  -                                                 ap_bucket *r);
  +/* append bucket(s) to a bucket_brigade */
  +APR_EXPORT(void) ap_bucket_brigade_append_buckets(ap_bucket_brigade *b,
  +                                                  ap_bucket *e);
   
   /* consume nbytes from beginning of b -- call ap_bucket_destroy as
       appropriate, and/or modify start on last element */
  @@ -189,14 +180,6 @@
   
   APR_EXPORT(int) ap_brigade_vprintf(ap_bucket_brigade *b, const char *fmt, va_list va);
   
  -/*   ******  Bucket List Functions  *****  */
  -
  -/* create a new bucket_list */
  -APR_EXPORT(ap_bucket_list *) ap_bucket_list_create(void);
  -
  -/* destroy an entire bucket_list */
  -APR_EXPORT(ap_status_t) ap_destroy_bucket_list(ap_bucket_list *b);
  -
   /*   ******  Bucket Functions  *****  */
   
   /* allocate a bucket of type color */
  @@ -204,6 +187,9 @@
   
   /* destroy a bucket */
   APR_EXPORT(ap_status_t) ap_bucket_destroy(ap_bucket *e);
  +
  +/* destroy an entire list of buckets */
  +APR_EXPORT(ap_status_t) ap_bucket_list_destroy(ap_bucket *e);
   
   /* Convert a bucket to a char * */
   APR_EXPORT(const char *) ap_get_bucket_char_str(ap_bucket *b);
  
  
  
  1.4       +339 -37   apache-2.0/src/lib/apr/buckets/ryan.patch
  
  Index: ryan.patch
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/buckets/ryan.patch,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ryan.patch	2000/07/14 00:27:28	1.3
  +++ ryan.patch	2000/07/17 23:49:35	1.4
  @@ -1,9 +1,6 @@
  -? build.log
  -? build.err
  -? .inslog2
   ? include/util_filter.h
  +? lib/apr/buckets/Makefile.in
   ? lib/apr/include/apr_buf.h
  -? lib/apr/shmem/config.cache
   ? main/util_filter.c
   Index: ap/Makefile.in
   ===================================================================
  @@ -11,7 +8,7 @@
   retrieving revision 1.4
   diff -u -d -b -w -u -r1.4 Makefile.in
   --- ap/Makefile.in	2000/06/12 20:41:13	1.4
  -+++ ap/Makefile.in	2000/07/14 00:24:57
  ++++ ap/Makefile.in	2000/07/17 23:40:28
   @@ -1,5 +1,5 @@
    
    LTLIBRARY_NAME    = libap.la
  @@ -25,7 +22,7 @@
   retrieving revision 1.19
   diff -u -d -b -w -u -r1.19 ap_iol.h
   --- include/ap_iol.h	2000/05/29 04:22:02	1.19
  -+++ include/ap_iol.h	2000/07/14 00:24:57
  ++++ include/ap_iol.h	2000/07/17 23:40:31
   @@ -58,6 +58,7 @@
    #define AP_IOL_H
    
  @@ -40,7 +37,7 @@
   retrieving revision 1.19
   diff -u -d -b -w -u -r1.19 http_protocol.h
   --- include/http_protocol.h	2000/07/11 03:48:17	1.19
  -+++ include/http_protocol.h	2000/07/14 00:24:57
  ++++ include/http_protocol.h	2000/07/17 23:40:31
   @@ -89,8 +89,15 @@
    API_EXPORT(void) ap_basic_http_header(request_rec *r);
    
  @@ -64,7 +61,7 @@
   retrieving revision 1.64
   diff -u -d -b -w -u -r1.64 httpd.h
   --- include/httpd.h	2000/06/30 21:18:13	1.64
  -+++ include/httpd.h	2000/07/14 00:24:57
  ++++ include/httpd.h	2000/07/17 23:40:32
   @@ -596,6 +596,11 @@
    				 * pointer back to the main request.
    				 */
  @@ -80,11 +77,11 @@
   Index: lib/apr/configure.in
   ===================================================================
   RCS file: /home/cvs/apache-2.0/src/lib/apr/configure.in,v
  -retrieving revision 1.133
  -diff -u -d -b -w -u -r1.133 configure.in
  ---- lib/apr/configure.in	2000/07/13 03:41:04	1.133
  -+++ lib/apr/configure.in	2000/07/14 00:24:58
  -@@ -678,8 +678,8 @@
  +retrieving revision 1.136
  +diff -u -d -b -w -u -r1.136 configure.in
  +--- lib/apr/configure.in	2000/07/15 15:39:05	1.136
  ++++ lib/apr/configure.in	2000/07/17 23:40:32
  +@@ -682,8 +682,8 @@
    AC_SUBST(EXEEXT)
    
    echo "Construct Makefiles and header files."
  @@ -95,13 +92,325 @@
    for dir in $MODULES
    do
        test -d $dir || $MKDIR -p $dir
  +Index: lib/apr/buckets/ap_buf.c
  +===================================================================
  +RCS file: /home/cvs/apache-2.0/src/lib/apr/buckets/ap_buf.c,v
  +retrieving revision 1.12
  +diff -u -d -b -w -u -r1.12 ap_buf.c
  +--- lib/apr/buckets/ap_buf.c	2000/07/14 00:24:33	1.12
  ++++ lib/apr/buckets/ap_buf.c	2000/07/17 23:40:33
  +@@ -100,10 +100,25 @@
  + APR_EXPORT(ap_status_t) ap_bucket_brigade_destroy(void *data)
  + {
  +     ap_bucket_brigade *b = data;
  +-    ap_bucket_list *bl = b->head;
  + 
  +-    ap_destroy_bucket_list(bl);
  ++    ap_bucket_list_destroy(b->head);
  ++    /* The brigade itself is allocated out of a pool, so we don't actually 
  ++     * want to free it.  If we did, we would do that free() here.
  ++     */
  ++
  ++    return APR_SUCCESS;
  ++}
  ++
  ++APR_EXPORT(ap_status_t) ap_bucket_list_destroy(ap_bucket *e)
  ++{
  ++    ap_bucket *cur = e;
  ++    ap_bucket *next;
  + 
  ++    while (cur) {
  ++        next = cur->next;
  ++        ap_bucket_destroy(cur);
  ++        cur = next;
  ++    }
  +     return APR_SUCCESS;
  + }        
  + 
  +@@ -120,18 +135,10 @@
  +     return b;
  + }
  + 
  +-APR_EXPORT(ap_bucket_list *) ap_bucket_list_create(void)
  +-{
  +-    ap_bucket_list *b;
  +-    
  +-    b = calloc(1, sizeof(*b));
  +-    return b;
  +-}
  +-
  +-APR_EXPORT(void) ap_bucket_brigade_append_list(ap_bucket_brigade *b, 
  +-                                               ap_bucket_list *e)
  ++APR_EXPORT(void) ap_bucket_brigade_append_buckets(ap_bucket_brigade *b, 
  ++                                                  ap_bucket *e)
  + {
  +-    ap_bucket_list *cur = e;
  ++    ap_bucket *cur = e;
  + 
  +     if (b->tail) {
  +         b->tail->next = e;
  +@@ -146,37 +153,17 @@
  +     }
  + }
  + 
  +-APR_EXPORT(void) ap_bucket_brigade_append_bucket(ap_bucket_brigade *b,
  +-                                                 ap_bucket *r)
  +-{
  +-    if (b->tail) {
  +-        if (b->tail->bucket == NULL) {
  +-            b->tail->bucket = r;
  +-        }
  +-        else {
  +-            b->tail->next = ap_bucket_list_create();
  +-            b->tail->next->prev = b->tail;
  +-            b->tail = b->tail->next;
  +-            b->tail->bucket = r;
  +-        }
  +-    }
  +-    else {
  +-        b->head = b->tail = ap_bucket_list_create();
  +-        b->tail->bucket = r;
  +-    }
  +-}
  +-
  + APR_EXPORT(int) ap_bucket_brigade_to_iovec(ap_bucket_brigade *b, 
  +                                            struct iovec *vec, int nvec)
  + {
  +-    ap_bucket_list *e;
  ++    ap_bucket *e;
  +     struct iovec *orig;
  + 
  +     orig = vec;
  +     e = b->head;
  +     while (e && nvec) {
  +-	vec->iov_base = (void *)ap_get_bucket_char_str(e->bucket);
  +-	vec->iov_len = ap_get_bucket_len(e->bucket);
  ++	vec->iov_base = (void *)ap_get_bucket_char_str(e);
  ++	vec->iov_len = ap_get_bucket_len(e);
  + 	e = e->next;
  + 	--nvec;
  + 	++vec;
  +@@ -207,12 +194,12 @@
  + 
  +     for (i=0; i < nvec; i++) {
  +         if (b->head == b->tail) {
  +-            ap_bucket_destroy(b->head->bucket);
  ++            ap_bucket_destroy(b->head);
  +             b->head = b->tail = NULL;
  +             break;
  +         }
  +         b->head = b->head->next;
  +-        ap_bucket_destroy(b->head->prev->bucket);
  ++        ap_bucket_destroy(b->head->prev);
  +         b->head->prev = NULL;
  +     }
  + }
  +@@ -241,17 +228,6 @@
  +     return APR_SUCCESS;
  + }
  + 
  +-APR_EXPORT(ap_status_t) ap_destroy_bucket_list(ap_bucket_list *buf)
  +-{
  +-    ap_bucket_list *dptr = buf;
  +-   
  +-    while (dptr) {
  +-        ap_bucket_destroy(dptr->bucket);
  +-        dptr = dptr->next;
  +-    }
  +-    return APR_SUCCESS;
  +-}
  +-
  + APR_EXPORT(const char *) ap_get_bucket_char_str(ap_bucket *b)
  + {
  +     if (b) {
  +@@ -275,10 +251,9 @@
  +     int j, k, rv;
  +     ap_ssize_t i;
  + 
  +-    if (b->tail && b->tail->bucket && 
  +-        b->tail->bucket->color == AP_BUCKET_rwmem) {
  ++    if (b->tail && b->tail->color == AP_BUCKET_rwmem) {
  +         ap_bucket *rw;
  +-        rw = b->tail->bucket;
  ++        rw = b->tail;
  +         /* I have no idea if this is a good idea or not.  Probably not.
  +          * Basically, if the last bucket in the list is a rwmem bucket,
  +          * then we just add to it instead of allocating a new read only
  +@@ -298,7 +273,7 @@
  +             }
  +             k += i;
  + 
  +-            ap_bucket_brigade_append_bucket(b, rw);
  ++            ap_bucket_brigade_append_buckets(b, rw);
  +         }        
  +     }
  +     
  +@@ -316,7 +291,7 @@
  +         }
  +         k += i;
  + 
  +-        ap_bucket_brigade_append_bucket(b, r);
  ++        ap_bucket_brigade_append_buckets(b, r);
  +     }
  + 
  +     return k;
  +@@ -346,7 +321,7 @@
  + 
  +     r = ap_bucket_new(AP_BUCKET_rwmem);
  +     res = r->insert(r, buf, strlen(buf), &i);
  +-    ap_bucket_brigade_append_bucket(b, r);
  ++    ap_bucket_brigade_append_buckets(b, r);
  + 
  +     return res;
  + }
  +Index: lib/apr/buckets/ap_eos_buf.c
  +===================================================================
  +RCS file: /home/cvs/apache-2.0/src/lib/apr/buckets/ap_eos_buf.c,v
  +retrieving revision 1.1
  +diff -u -d -b -w -u -r1.1 ap_eos_buf.c
  +--- lib/apr/buckets/ap_eos_buf.c	2000/07/13 21:48:33	1.1
  ++++ lib/apr/buckets/ap_eos_buf.c	2000/07/17 23:40:33
  +@@ -73,7 +73,7 @@
  + {
  +     ap_bucket *newbuf;
  + 
  +-    newbuf            = malloc(sizeof(*newbuf));
  ++    newbuf            = calloc(1, sizeof(*newbuf));
  + 
  +     newbuf->color     = AP_BUCKET_eos;
  +     newbuf->getstr    = eos_get_str;
  +Index: lib/apr/buckets/ap_mmap_buf.c
  +===================================================================
  +RCS file: /home/cvs/apache-2.0/src/lib/apr/buckets/ap_mmap_buf.c,v
  +retrieving revision 1.4
  +diff -u -d -b -w -u -r1.4 ap_mmap_buf.c
  +--- lib/apr/buckets/ap_mmap_buf.c	2000/07/14 00:24:33	1.4
  ++++ lib/apr/buckets/ap_mmap_buf.c	2000/07/17 23:40:33
  +@@ -89,7 +89,7 @@
  +     ap_bucket *newbuf;
  +     ap_bucket_mmap *b;
  + 
  +-    newbuf            = malloc(sizeof(*newbuf));
  ++    newbuf            = calloc(1, sizeof(*newbuf));
  +     b                 = malloc(sizeof(*b));
  + 
  +     b->data      = NULL;
  +Index: lib/apr/buckets/ap_rmem_buf.c
  +===================================================================
  +RCS file: /home/cvs/apache-2.0/src/lib/apr/buckets/ap_rmem_buf.c,v
  +retrieving revision 1.5
  +diff -u -d -b -w -u -r1.5 ap_rmem_buf.c
  +--- lib/apr/buckets/ap_rmem_buf.c	2000/07/14 00:24:33	1.5
  ++++ lib/apr/buckets/ap_rmem_buf.c	2000/07/17 23:40:33
  +@@ -106,7 +106,7 @@
  +     ap_bucket *newbuf;
  +     ap_bucket_rmem *b;
  + 
  +-    newbuf                = malloc(sizeof(*newbuf));
  ++    newbuf                = calloc(1, sizeof(*newbuf));
  +     b                     = malloc(sizeof(*b)); 
  + 
  +     b->alloc_len          = 0;
  +Index: lib/apr/buckets/ap_rwmem_buf.c
  +===================================================================
  +RCS file: /home/cvs/apache-2.0/src/lib/apr/buckets/ap_rwmem_buf.c,v
  +retrieving revision 1.5
  +diff -u -d -b -w -u -r1.5 ap_rwmem_buf.c
  +--- lib/apr/buckets/ap_rwmem_buf.c	2000/07/14 00:24:33	1.5
  ++++ lib/apr/buckets/ap_rwmem_buf.c	2000/07/17 23:40:33
  +@@ -124,7 +124,7 @@
  +     ap_bucket *newbuf;
  +     ap_bucket_rwmem *b;
  + 
  +-    newbuf = malloc(sizeof(*newbuf));
  ++    newbuf = calloc(1, sizeof(*newbuf));
  +     b = malloc(sizeof(*b));
  +     
  +     b->alloc_addr = calloc(DEFAULT_RWBUF_SIZE, 1);
  +Index: lib/apr/buckets/apr_buf.h
  +===================================================================
  +RCS file: /home/cvs/apache-2.0/src/lib/apr/buckets/apr_buf.h,v
  +retrieving revision 1.13
  +diff -u -d -b -w -u -r1.13 apr_buf.h
  +--- lib/apr/buckets/apr_buf.h	2000/07/14 00:24:33	1.13
  ++++ lib/apr/buckets/apr_buf.h	2000/07/17 23:40:33
  +@@ -95,13 +95,8 @@
  +      * into the bucket.
  +      */ 
  +     int (*insert)(ap_bucket *e, const void *buf, ap_size_t nbytes, ap_ssize_t *w);
  +-};
  +-
  +-typedef struct ap_bucket_list ap_bucket_list;
  +-struct ap_bucket_list {
  +-    ap_bucket *bucket;                   /* The bucket */
  +-    ap_bucket_list *next;                /* The next node in the bucket list */
  +-    ap_bucket_list *prev;                /* The prev node in the bucket list */
  ++    ap_bucket *next;                     /* The next node in the bucket list */
  ++    ap_bucket *prev;                     /* The prev node in the bucket list */
  + };
  + 
  + typedef struct ap_bucket_brigade ap_bucket_brigade;
  +@@ -111,8 +106,8 @@
  +                                            but this lets me register a cleanup
  +                                            to put a limit on the brigade's 
  +                                            lifetime. */
  +-    ap_bucket_list *head;               /* The start of the brigade */
  +-    ap_bucket_list *tail;               /* The end of the brigade */
  ++    ap_bucket *head;                    /* The start of the brigade */
  ++    ap_bucket *tail;                    /* The end of the brigade */
  + };
  + 
  + /*    ******  Different bucket types   *****/
  +@@ -151,14 +146,10 @@
  + 
  + /* destroy an enitre bucket brigade */
  + APR_EXPORT(ap_status_t) ap_bucket_brigade_destroy(void *b);
  +-
  +-/* append a bucket_list to a bucket_brigade */
  +-APR_EXPORT(void) ap_bucket_brigade_append_list(ap_bucket_brigade *b, 
  +-                                               ap_bucket_list *e);
  + 
  +-/* append a bucket to a bucket_brigade */
  +-APR_EXPORT(void) ap_bucket_brigade_append_bucket(ap_bucket_brigade *b,
  +-                                                 ap_bucket *r);
  ++/* append bucket(s) to a bucket_brigade */
  ++APR_EXPORT(void) ap_bucket_brigade_append_buckets(ap_bucket_brigade *b,
  ++                                                  ap_bucket *e);
  + 
  + /* consume nbytes from beginning of b -- call ap_bucket_destroy as
  +     appropriate, and/or modify start on last element */
  +@@ -189,14 +180,6 @@
  + 
  + APR_EXPORT(int) ap_brigade_vprintf(ap_bucket_brigade *b, const char *fmt, va_list va);
  + 
  +-/*   ******  Bucket List Functions  *****  */
  +-
  +-/* create a new bucket_list */
  +-APR_EXPORT(ap_bucket_list *) ap_bucket_list_create(void);
  +-
  +-/* destroy an entire bucket_list */
  +-APR_EXPORT(ap_status_t) ap_destroy_bucket_list(ap_bucket_list *b);
  +-
  + /*   ******  Bucket Functions  *****  */
  + 
  + /* allocate a bucket of type color */
  +@@ -204,6 +187,9 @@
  + 
  + /* destroy a bucket */
  + APR_EXPORT(ap_status_t) ap_bucket_destroy(ap_bucket *e);
  ++
  ++/* destroy an entire list of buckets */
  ++APR_EXPORT(ap_status_t) ap_bucket_list_destroy(ap_bucket *e);
  + 
  + /* Convert a bucket to a char * */
  + APR_EXPORT(const char *) ap_get_bucket_char_str(ap_bucket *b);
   Index: main/Makefile.in
   ===================================================================
   RCS file: /home/cvs/apache-2.0/src/main/Makefile.in,v
   retrieving revision 1.16
   diff -u -d -b -w -u -r1.16 Makefile.in
   --- main/Makefile.in	2000/07/01 14:14:15	1.16
  -+++ main/Makefile.in	2000/07/14 00:25:04
  ++++ main/Makefile.in	2000/07/17 23:40:52
   @@ -8,7 +8,7 @@
    	http_protocol.c http_request.c http_vhost.c util.c util_date.c \
    	util_script.c util_uri.c util_md5.c util_cfgtree.c util_ebcdic.c \
  @@ -117,7 +426,7 @@
   retrieving revision 1.88
   diff -u -d -b -w -u -r1.88 http_core.c
   --- main/http_core.c	2000/07/11 03:48:18	1.88
  -+++ main/http_core.c	2000/07/14 00:25:04
  ++++ main/http_core.c	2000/07/17 23:40:52
   @@ -71,6 +71,8 @@
    #include "util_md5.h"
    #include "apr_fnmatch.h"
  @@ -156,7 +465,7 @@
   +static int core_filter(request_rec *r, ap_filter_t *f, ap_bucket_brigade *b)
   +{
   +    ap_ssize_t bytes_sent;
  -+    ap_bucket_list *dptr;
  ++    ap_bucket *dptr;
   +    int len = 0;
   +
   +    if (!r->headers_sent) {
  @@ -174,10 +483,10 @@
   +     */
   +    dptr = b->head; 
   +    while (dptr) { 
  -+        len += ap_get_bucket_len(dptr->bucket);
  ++        len += ap_get_bucket_len(dptr);
   +        dptr = dptr->next;
   +    }
  -+    if (len < MIN_SIZE_TO_WRITE && b->tail->bucket->color != AP_BUCKET_eos) {
  ++    if (len < MIN_SIZE_TO_WRITE && b->tail->color != AP_BUCKET_eos) {
   +        ap_save_data_to_filter(r, f, b);
   +        return 0;
   +    } 
  @@ -217,7 +526,7 @@
   retrieving revision 1.96
   diff -u -d -b -w -u -r1.96 http_protocol.c
   --- main/http_protocol.c	2000/07/13 16:26:42	1.96
  -+++ main/http_protocol.c	2000/07/14 00:25:04
  ++++ main/http_protocol.c	2000/07/17 23:40:52
   @@ -64,6 +64,8 @@
     */
    
  @@ -246,12 +555,12 @@
   +    ap_bucket_brigade *bb = NULL;
   +    ap_bucket *b = NULL;
   +    ap_filter_t *f;
  -+
  +     
   +    /* if you are using the older API's, then Apache will initiate the 
   +     * filtering for you.
   +     */
   +    f = ap_init_filter(r->pool);   
  -     
  ++    
        if (length == 0)
            return 0;
    
  @@ -264,7 +573,7 @@
        while (!r->connection->aborted && offset < length) {
            if (length - offset > MMAP_SEGMENT_SIZE) {
                n = MMAP_SEGMENT_SIZE;
  -@@ -2467,76 +2477,137 @@
  +@@ -2467,76 +2477,132 @@
            total_bytes_sent += w;
            offset += w;
        }
  @@ -276,10 +585,9 @@
   +     * that does all of this for us.
   +     */
   +    bb = ap_bucket_brigade_create(r->pool);
  -+    bb->head = bb->tail = ap_bucket_list_create();
   +    b = ap_bucket_new(AP_BUCKET_mmap);
   +    b->insert(b, mm, mm->size, &total_bytes_sent);
  -+    bb->head->bucket = b;
  ++    bb->head = bb->tail = b;
   +    total_bytes_sent = ap_pass_brigade(r, f, bb);
   +
        return total_bytes_sent;
  @@ -311,10 +619,9 @@
   +     * that does all of this for us.
   +     */
   +    bb = ap_bucket_brigade_create(r->pool);
  -+    bb->head = bb->tail = ap_bucket_list_create();
   +    b = ap_bucket_new(AP_BUCKET_rwmem);
   +    b->insert(b, &c, 1, &written); 
  -+    bb->head->bucket = b;
  ++    bb->head = bb->tail = b;
   +    ap_pass_brigade(r, f, bb);
   +
        return c;
  @@ -348,10 +655,9 @@
   +     * that does all of this for us.
   +     */
   +    bb = ap_bucket_brigade_create(r->pool);
  -+    bb->head = bb->tail = ap_bucket_list_create();
   +    b = ap_bucket_new(AP_BUCKET_rwmem);
   +    b->insert(b, str, strlen(str), &written); 
  -+    bb->head->bucket = b;
  ++    bb->head = bb->tail = b;
   +    ap_pass_brigade(r, f, bb);
   +
   +    return written;
  @@ -387,10 +693,9 @@
   +     * that does all of this for us.
   +     */
   +    bb = ap_bucket_brigade_create(r->pool);
  -+    bb->head = bb->tail = ap_bucket_list_create();
   +    b = ap_bucket_new(AP_BUCKET_rwmem);
   +    b->insert(b, buf, nbyte, &written); 
  -+    bb->head->bucket = b;
  ++    bb->head = bb->tail = b;
   +    ap_pass_brigade(r, f, bb);
   +    return written;
    }
  @@ -422,7 +727,6 @@
   +     * that does all of this for us.
   +     */
   +    bb = ap_bucket_brigade_create(r->pool);
  -+    bb->head = bb->tail = ap_bucket_list_create();
   +    written = ap_brigade_vprintf(bb, fmt, va);
   +    ap_pass_brigade(r, f, bb);
   +    return written;
  @@ -434,7 +738,7 @@
    API_EXPORT_NONSTD(int) ap_rprintf(request_rec *r, const char *fmt, ...)
    {
        va_list va;
  -@@ -2546,46 +2617,60 @@
  +@@ -2546,46 +2612,58 @@
            return EOF;
    
        va_start(va, fmt);
  @@ -471,7 +775,6 @@
   +     * that does all of this for us.
   +     */
   +    bb = ap_bucket_brigade_create(r->pool);
  -+    bb->head = bb->tail = ap_bucket_list_create();
        va_start(va, r);
   -    n = ap_vbputstrs(r->connection->client, va);
   +    written = ap_brigade_vputstrs(bb, va);
  @@ -509,9 +812,8 @@
   +     * that does all of this for us.
   +     */
   +    bb = ap_bucket_brigade_create(r->pool);
  -+    bb->head = bb->tail = ap_bucket_list_create();
   +    b = ap_bucket_new(AP_BUCKET_eos);
  -+    bb->head->bucket = b;
  ++    bb->head = bb->tail = b;
   +    ap_pass_brigade(r, f, bb);
        return 0;
    }
  @@ -522,7 +824,7 @@
   retrieving revision 1.35
   diff -u -d -b -w -u -r1.35 http_request.c
   --- main/http_request.c	2000/06/24 17:33:57	1.35
  -+++ main/http_request.c	2000/07/14 00:25:04
  ++++ main/http_request.c	2000/07/17 23:40:52
   @@ -1263,6 +1263,12 @@
            return;
        }
  @@ -542,7 +844,7 @@
   retrieving revision 1.23
   diff -u -d -b -w -u -r1.23 config.m4
   --- modules/mpm/config.m4	2000/07/11 19:00:16	1.23
  -+++ modules/mpm/config.m4	2000/07/14 00:25:05
  ++++ modules/mpm/config.m4	2000/07/17 23:40:58
   @@ -3,7 +3,6 @@
    [  --with-mpm=MPM          Choose the process model for Apache to use.
                              MPM={dexter,mpmt_beos,mpmt_pthread,prefork,spmt_os2}],[