You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by fa...@locus.apache.org on 2000/09/04 07:42:21 UTC

cvs commit: apache-2.0/src/include ap_buckets.h

fanf        00/09/03 22:42:20

  Modified:    src/ap   ap_buckets.c ap_buckets_heap.c ap_buckets_pipe.c
               src/include ap_buckets.h
  Log:
  avoid a copy in the pipe bucket read code
  and make the length return argument in ap_bucket_create_heap optional
  (which is only really true when not copying)
  
  Revision  Changes    Path
  1.12      +2 -2      apache-2.0/src/ap/ap_buckets.c
  
  Index: ap_buckets.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/ap/ap_buckets.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -u -r1.11 -r1.12
  --- ap_buckets.c	2000/08/20 03:33:08	1.11
  +++ ap_buckets.c	2000/09/04 05:42:19	1.12
  @@ -208,11 +208,11 @@
        */
       char buf[4096];
       ap_bucket *r;
  -    int res, i;
  +    int res;
   
       res = apr_vsnprintf(buf, 4096, fmt, va);
   
  -    r = ap_bucket_create_heap(buf, strlen(buf), 1, &i);
  +    r = ap_bucket_create_heap(buf, strlen(buf), 1, NULL);
       ap_brigade_append_buckets(b, r);
   
       return res;
  
  
  
  1.10      +2 -1      apache-2.0/src/ap/ap_buckets_heap.c
  
  Index: ap_buckets_heap.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/ap/ap_buckets_heap.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -u -r1.9 -r1.10
  --- ap_buckets_heap.c	2000/08/19 16:54:45	1.9
  +++ ap_buckets_heap.c	2000/09/04 05:42:20	1.10
  @@ -133,7 +133,8 @@
       b->read     = heap_read;
       b->setaside = NULL;
   
  -    *w = length;
  +    if (w)
  +        *w = length;
   
       return b;
   }
  
  
  
  1.5       +11 -14    apache-2.0/src/ap/ap_buckets_pipe.c
  
  Index: ap_buckets_pipe.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/ap/ap_buckets_pipe.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -u -r1.4 -r1.5
  --- ap_buckets_pipe.c	2000/08/31 16:54:12	1.4
  +++ ap_buckets_pipe.c	2000/09/04 05:42:20	1.5
  @@ -67,31 +67,28 @@
   }
   
   /* Ignore the block arg for now.  We can fix that tomorrow. */
  -static apr_status_t pipe_read(ap_bucket *b, const char **str, 
  +static apr_status_t pipe_read(ap_bucket *b, const char **str,
   				apr_ssize_t *len, int block)
   {
       ap_bucket_pipe *bd = b->data;
       ap_bucket *a;
  -    apr_size_t l;
  -    apr_ssize_t toss;
  -    char buf[IOBUFSIZE];
  +    char *buf;
       apr_status_t rv;
   
  +    /*
  +     * XXX: We need to obey the block flag
  +     */
  +    buf = malloc(IOBUFSIZE);
  +    *str = buf;
       *len = IOBUFSIZE;
       if ((rv = apr_read(bd->thepipe, buf, len)) != APR_SUCCESS) {
  +	free(buf);
           return rv;
       }
  -    if (*len > 0) {
  -        l = *len;
  +    if (len > 0) {
           a = ap_bucket_create_pipe(bd->thepipe);
  -        
  -        /* XXX ap_bucket_make_heap() can decide not to copy all our data;
  -         * either handle it here or ensure that IOBUFSIZE < 
  -         * DEFAULT_BUCKET_SIZE;
  -         */
  -        b = ap_bucket_make_heap(b, buf, l, 1, &toss);
  -        b->read(b, str, len, block); /* set str to new location of data */
  -
  +        b = ap_bucket_make_heap(b, buf, *len, 0, NULL);
  +	
           if (b->next) {
               b->next->prev = a;
           }
  
  
  
  1.18      +2 -1      apache-2.0/src/include/ap_buckets.h
  
  Index: ap_buckets.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/include/ap_buckets.h,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -u -r1.17 -r1.18
  --- ap_buckets.h	2000/08/29 17:13:48	1.17
  +++ ap_buckets.h	2000/09/04 05:42:20	1.18
  @@ -540,7 +540,8 @@
    * @param buf The buffer to insert into the bucket
    * @param nbyte The size of the buffer to insert.
    * @param copy Whether to copy the data into newly-allocated memory or not
  - * @param w The number of bytes actually copied into the bucket
  + * @param w The number of bytes actually copied into the bucket.
  + *          If copy is zero then this return value can be ignored by passing a NULL pointer.
    * @return The new bucket, or NULL if allocation failed
    * @deffunc ap_bucket *ap_bucket_create_heap(const char *buf, apr_size_t nbyte, apr_ssize_t *w)
    */