apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@covalent.net
Subject Re: cvs commit: apr-util/buckets apr_buckets_heap.c
Date Tue, 06 Feb 2001 16:28:53 GMT

>   Modified:    modules/generators mod_cgi.c mod_cgid.c
>                buckets  apr_buckets_heap.c

Damn, I committed from too high in my tree.  :-(

The bucket change was supposed to happen in the next commit.  Basically,
we try to overallocate in the heap bucket itself, which is
incorrect.  This patch fixes that behavior, so that we don't try to
outsmart the bucket in the make_heap function.

If we want to buffer data in a bucket, then we have to do it right, which
means having functions that can take care of the extra space.  This is
what the patch I posted last night does, so the current hack goes away,
because it is just allocating extra space that we never use.

>   Index: apr_buckets_heap.c
>   ===================================================================
>   RCS file: /home/cvs/apr-util/buckets/apr_buckets_heap.c,v
>   retrieving revision 1.23
>   retrieving revision 1.24
>   diff -u -d -b -w -u -r1.23 -r1.24
>   --- apr_buckets_heap.c	2001/01/19 07:02:00	1.23
>   +++ apr_buckets_heap.c	2001/02/06 16:21:17	1.24
>   @@ -58,20 +58,6 @@
>    #include <strings.h>
>    #endif
>    
>   -/*
>   - * The size of heap bucket memory allocations.
>   - * XXX: This is currently a guess and should be adjusted to an
>   - * empirically good value.
>   - */
>   -#ifndef DEFAULT_BUCKET_SIZE
>   -#define DEFAULT_BUCKET_SIZE (4096)
>   -#endif
>   -
>   -#ifndef max
>   -#define max(x,y) \
>   -((x) >= (y) ? (x) : (y))
>   -#endif
>   -
>    static apr_status_t heap_read(apr_bucket *b, const char **str, 
>    			      apr_size_t *len, apr_read_type_e block)
>    {
>   @@ -106,7 +92,7 @@
>        }
>    
>        if (copy) {
>   -	h->alloc_len = max(DEFAULT_BUCKET_SIZE, length);
>   +	h->alloc_len = length;
>    	h->base = malloc(h->alloc_len);
>    	if (h->base == NULL) {
>    	    free(h);
>   
>   
>   
> 
> 


_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Mime
View raw message