apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwool...@apache.org
Subject cvs commit: apr-util/buckets apr_buckets_file.c
Date Sun, 18 Feb 2001 00:08:59 GMT
jwoolley    01/02/17 16:08:59

  Modified:    buckets  apr_buckets_file.c
  Log:
  Optimize file_read() in the non-MMAP case.  When we have to add a new file
  bucket to the brigade after the newly morphed 8KB heap bucket, we were
  destroying the shared+file bucket we already had just to turn around and
  make a new one again.  All we really need is a new apr_bucket struct
  to wrap around it.
  
  (Woohoo, my first commit!)
  
  Revision  Changes    Path
  1.32      +10 -2     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.31
  retrieving revision 1.32
  diff -u -d -u -r1.31 -r1.32
  --- apr_buckets_file.c	2001/02/16 17:37:57	1.31
  +++ apr_buckets_file.c	2001/02/18 00:08:57	1.32
  @@ -166,10 +166,18 @@
           apr_bucket_heap_make(e, buf, *len, 0, NULL); /*XXX: check for failure? */
           /* If we have more to read from the file, then create another bucket */
           if (length > 0) {
  -            b = apr_bucket_file_create(f, s->start + (*len), length);
  +            /* for efficiency, we can just build a new apr_bucket struct
  +             * to wrap around the existing shared+file bucket */
  +            s->start += (*len);
  +            b = malloc(sizeof(*b));
  +            b->data = s;
  +            b->type = &apr_bucket_type_file;
  +            b->length = length;
               APR_BUCKET_INSERT_AFTER(e, b);
           }
  -        file_destroy(s);
  +        else {
  +            file_destroy(s);
  +        }
   
   #if APR_HAS_MMAP
       }
  
  
  

Mime
View raw message