httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@locus.apache.org
Subject cvs commit: apache-2.0/src/lib/apr/buckets ap_buf.c ap_mmap_buf.c ap_rmem_buf.c ap_rwmem_buf.c apr_buf.h
Date Mon, 31 Jul 2000 22:28:59 GMT
rbb         00/07/31 15:28:58

  Modified:    src/lib/apr/buckets ap_buf.c ap_mmap_buf.c ap_rmem_buf.c
                        ap_rwmem_buf.c apr_buf.h
  Log:
  Combine the create and write functions.  I am leaving the write function
  pointer in the structure because I think it is still useful, but having
  one API to create a bucket and put data in it is much cleaner.  If we
  decide to have a list of free buckets, then the create function may not
  call malloc, it may grab a bucket off the free list.  Regardless of where
  the memory comes from, create's job is to grab the memory from someplace
  and fill out the structure.
  
  Revision  Changes    Path
  1.18      +2 -4      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.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- ap_buf.c	2000/07/23 05:43:35	1.17
  +++ ap_buf.c	2000/07/31 22:28:57	1.18
  @@ -258,8 +258,7 @@
               break;
           j = strlen(x);
          
  -        r = ap_bucket_rwmem_create();
  -        rv = r->write(r, x, j, &i);
  +        r = ap_bucket_rwmem_create(x, j, &i);
           if (i != j) {
               /* Do we need better error reporting?  */
               return -1;
  @@ -294,8 +293,7 @@
   
       res = ap_vsnprintf(buf, 4096, fmt, va);
   
  -    r = ap_bucket_rwmem_create();
  -    res = r->write(r, buf, strlen(buf), &i);
  +    r = ap_bucket_rwmem_create(buf, strlen(buf), &i);
       ap_bucket_brigade_append_buckets(b, r);
   
       return res;
  
  
  
  1.10      +7 -3      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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ap_mmap_buf.c	2000/07/23 05:43:35	1.9
  +++ ap_mmap_buf.c	2000/07/31 22:28:57	1.10
  @@ -88,8 +88,9 @@
       ap_bucket *newbuck;
       ap_bucket_mmap *a = (ap_bucket_mmap *)e->data;
       ap_bucket_mmap *b;
  +    ap_ssize_t dump;
   
  -    newbuck = ap_bucket_mmap_create();
  +    newbuck = ap_bucket_mmap_create(a->alloc_addr, a->len, &dump);
       b = (ap_bucket_mmap *)newbuck->data;
       a->alloc_addr = a->alloc_addr + nbyte;
       a->len = b->len - nbyte;
  @@ -103,7 +104,8 @@
       return APR_SUCCESS;
   }
   
  -APR_EXPORT(ap_bucket *) ap_bucket_mmap_create(void)
  +APR_EXPORT(ap_bucket *) ap_bucket_mmap_create(const void *buf, 
  +                                      ap_size_t nbytes, ap_ssize_t *w)
   {
       ap_bucket *newbuf;
       ap_bucket_mmap *b;
  @@ -114,13 +116,15 @@
       b->alloc_addr     = NULL;
       b->len            = 0;
   
  +    newbuf->data      = b;
  +    mmap_bucket_insert(newbuf, buf, nbytes, w);
  +
       newbuf->color     = AP_BUCKET_mmap;
       newbuf->read      = mmap_get_str;
       newbuf->getlen    = mmap_get_len;
       newbuf->write     = mmap_bucket_insert;
       newbuf->split     = mmap_split;
       newbuf->free      = NULL;
  -    newbuf->data      = b;
       
       return newbuf;
   }
  
  
  
  1.10      +7 -3      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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ap_rmem_buf.c	2000/07/23 05:43:35	1.9
  +++ ap_rmem_buf.c	2000/07/31 22:28:58	1.10
  @@ -80,8 +80,9 @@
       ap_bucket *newbuck;
       ap_bucket_rmem *a = (ap_bucket_rmem *)e->data; 
       ap_bucket_rmem *b; 
  +    ap_ssize_t dump;
   
  -    newbuck = ap_bucket_rmem_create();
  +    newbuck = ap_bucket_rmem_create(a->start, a->alloc_len, &dump);
       b = (ap_bucket_rmem *)newbuck->data;
   
       b->alloc_len = a->alloc_len - nbyte;
  @@ -124,7 +125,8 @@
       return APR_SUCCESS;
   }
   
  -APR_EXPORT(ap_bucket *) ap_bucket_rmem_create(void)
  +APR_EXPORT(ap_bucket *) ap_bucket_rmem_create(const void *buf,
  +                               ap_size_t nbyte, ap_ssize_t *w)
   {
       ap_bucket *newbuf;
       ap_bucket_rmem *b;
  @@ -135,13 +137,15 @@
       b->alloc_len          = 0;
       b->start = b->end     = NULL;
   
  +    newbuf->data          = b;
  +    rmem_insert(newbuf, buf, nbyte, w);
  +
       newbuf->color         = AP_BUCKET_rmem;
       newbuf->read          = rmem_get_str;
       newbuf->getlen        = rmem_get_len;
       newbuf->write         = rmem_insert;
       newbuf->split         = rmem_split;
       newbuf->free          = NULL;
  -    newbuf->data          = b;
       return newbuf;
   }
   
  
  
  
  1.10      +8 -4      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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ap_rwmem_buf.c	2000/07/23 05:43:35	1.9
  +++ ap_rwmem_buf.c	2000/07/31 22:28:58	1.10
  @@ -86,9 +86,10 @@
       ap_bucket *newbuck;
       ap_bucket_rwmem *a = (ap_bucket_rwmem *)e;
       ap_bucket_rwmem *b;
  +    ap_ssize_t dump; 
   
  -    newbuck = ap_bucket_rwmem_create();
  -    b = (ap_bucket_rwmem *)newbuck;
  +    newbuck = ap_bucket_rwmem_create(a->alloc_addr, a->alloc_len, &dump);
  +    b = (ap_bucket_rwmem *)newbuck->data;
   
       b->alloc_addr = a->alloc_addr;
       b->alloc_len = a->alloc_len;
  @@ -141,7 +142,8 @@
       return APR_SUCCESS;
   }
   
  -APR_EXPORT(ap_bucket *) ap_bucket_rwmem_create(void)
  +APR_EXPORT(ap_bucket *) ap_bucket_rwmem_create(const void *buf,
  +                                ap_size_t nbyte, ap_ssize_t *w)
   {
       ap_bucket *newbuf;
       ap_bucket_rwmem *b;
  @@ -154,13 +156,15 @@
       b->start      = b->alloc_addr;
       b->end        = b->alloc_addr;
   
  +    newbuf->data       = b;
  +    rwmem_insert(newbuf, buf, nbyte, w); 
  +
       newbuf->color      = AP_BUCKET_rwmem;
       newbuf->read       = rwmem_get_str;
       newbuf->getlen     = rwmem_get_len;
       newbuf->write      = rwmem_insert;
       newbuf->split      = rwmem_split;
       newbuf->free       = rwmem_destroy;
  -    newbuf->data       = b;
   
       return newbuf;
   }
  
  
  
  1.18      +8 -4      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.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- apr_buf.h	2000/07/23 05:43:35	1.17
  +++ apr_buf.h	2000/07/31 22:28:58	1.18
  @@ -57,8 +57,8 @@
   
   #include "apr_mmap.h"
   #include "apr_errno.h"
  -#include "../../../include/ap_iol.h"
   #include "apr_private.h"
  +#include "../../../include/ap_iol.h"
   #ifdef HAVE_SYS_UIO_H
   #include <sys/uio.h>	/* for struct iovec */
   #endif
  @@ -249,13 +249,17 @@
   /****** Functions to Create Buckets of varying type ******/
   
   /* Create a read/write memory bucket */
  -APR_EXPORT(ap_bucket *) ap_bucket_rwmem_create(void);
  +APR_EXPORT(ap_bucket *) ap_bucket_rwmem_create(const void *buf,
  +                                ap_size_t nbyte, ap_ssize_t *w);
  +
   
   /* Create a mmap memory bucket */
  -APR_EXPORT(ap_bucket *) ap_bucket_mmap_create(void);
  +APR_EXPORT(ap_bucket *) ap_bucket_mmap_create(const void *buf,
  +                                      ap_size_t nbytes, ap_ssize_t *w);
   
   /* Create a read only memory bucket. */
  -APR_EXPORT(ap_bucket *) ap_bucket_rmem_create(void);
  +APR_EXPORT(ap_bucket *) ap_bucket_rmem_create(const void *buf,
  +                               ap_size_t nbyte, ap_ssize_t *w);
   
   /* Create an End of Stream bucket */
   APR_EXPORT(ap_bucket *) ap_bucket_eos_create(void);
  
  
  

Mime
View raw message