Return-Path: Delivered-To: apmail-apr-cvs-archive@apr.apache.org Received: (qmail 80618 invoked by uid 500); 18 Feb 2001 01:43:05 -0000 Mailing-List: contact cvs-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Reply-To: dev@apr.apache.org Delivered-To: mailing list cvs@apr.apache.org Delivered-To: moderator for cvs@apr.apache.org Received: (qmail 30088 invoked by uid 500); 18 Feb 2001 00:09:00 -0000 Delivered-To: apmail-apr-util-cvs@apache.org Date: 18 Feb 2001 00:08:59 -0000 Message-ID: <20010218000859.30081.qmail@apache.org> From: jwoolley@apache.org To: apr-util-cvs@apache.org Subject: cvs commit: apr-util/buckets apr_buckets_file.c 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 }