Return-Path: Delivered-To: apmail-apr-dev-archive@www.apache.org Received: (qmail 16255 invoked from network); 30 Sep 2004 15:23:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 30 Sep 2004 15:23:01 -0000 Received: (qmail 64063 invoked by uid 500); 30 Sep 2004 15:22:58 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 63946 invoked by uid 500); 30 Sep 2004 15:22:57 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 63883 invoked by uid 99); 30 Sep 2004 15:22:56 -0000 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=DNS_FROM_RFC_ABUSE X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Message-ID: <415C24C1.2060505@us.ibm.com> Date: Thu, 30 Sep 2004 11:22:41 -0400 From: Allan Edwards User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031007 X-Accept-Language: en-us, en MIME-Version: 1.0 To: dev@apr.apache.org Subject: Re: [PATCH] WIN64: apr_pools.c References: <415B2AA6.1030405@us.ibm.com> <20040929220052.GA16131@redhat.com> In-Reply-To: <20040929220052.GA16131@redhat.com> Content-Type: multipart/mixed; boundary="------------050808060203020100070100" X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N This is a multi-part message in MIME format. --------------050808060203020100070100 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Joe Orton wrote: > It is part of the API, it can't be changed like this in 1.x. You can't > use the apr_allocator_* API without using the apr_memnode_t structure, The allocator API uses an incomplete type for apr_allocator_t and in the same way should (actually it does) use an incomplete type for apr_memnode_t. It just seems like an oversight that the definition of apr_memnode_t was left in apr_allocator.h > so I don't see how it could be made private either. This patch demonstates that it can be made private, httpd builds cleanly against it. The only reason I can see that this breaks the API is if someone were doing strange and unnatural things outside of the normal use of the API. Do we want to deny this change because of that remote possibility? Allan Index: apr/include/apr_allocator.h =================================================================== RCS file: /home/cvs/apr/include/apr_allocator.h,v retrieving revision 1.19 diff -U3 -r1.19 apr_allocator.h --- apr/include/apr_allocator.h 13 Feb 2004 09:38:28 -0000 1.19 +++ apr/include/apr_allocator.h 30 Sep 2004 15:09:58 -0000 @@ -41,27 +41,6 @@ /** the structure which holds information about the allocation */ typedef struct apr_memnode_t apr_memnode_t; -/** basic memory node structure - * @note The next, ref and first_avail fields are available for use by the - * caller of apr_allocator_alloc(), the remaining fields are read-only. - * The next field has to be used with caution and sensibly set when the - * memnode is passed back to apr_allocator_free(). See apr_allocator_free() - * for details. - * The ref and first_avail fields will be properly restored by - * apr_allocator_free(). - */ -struct apr_memnode_t { - apr_memnode_t *next; /**< next memnode */ - apr_memnode_t **ref; /**< reference to self */ - apr_uint32_t index; /**< size */ - apr_uint32_t free_index; /**< how much free */ - char *first_avail; /**< pointer to first free memory */ - char *endp; /**< pointer to end of free memory */ -}; - -/** The base size of a memory node - aligned. */ -#define APR_MEMNODE_T_SIZE APR_ALIGN_DEFAULT(sizeof(apr_memnode_t)) - /** Symbolic constants */ #define APR_ALLOCATOR_MAX_FREE_UNLIMITED 0 Index: apr/memory/unix/apr_pools.c =================================================================== RCS file: /home/cvs/apr/memory/unix/apr_pools.c,v retrieving revision 1.206 diff -U3 -r1.206 apr_pools.c --- apr/memory/unix/apr_pools.c 17 Jun 2004 14:13:58 -0000 1.206 +++ apr/memory/unix/apr_pools.c 30 Sep 2004 15:09:58 -0000 @@ -21,7 +21,7 @@ #include "apr_strings.h" #include "apr_general.h" #include "apr_pools.h" -#include "apr_allocator.h" +#include "arch/unix/apr_arch_allocator.h" #include "apr_lib.h" #include "apr_thread_mutex.h" #include "apr_hash.h" @@ -63,9 +63,9 @@ */ struct apr_allocator_t { - apr_uint32_t max_index; - apr_uint32_t max_free_index; - apr_uint32_t current_free_index; + apr_size_t max_index; + apr_size_t max_free_index; + apr_size_t current_free_index; #if APR_HAS_THREADS apr_thread_mutex_t *mutex; #endif /* APR_HAS_THREADS */ @@ -141,7 +141,7 @@ APR_DECLARE(void) apr_allocator_max_free_set(apr_allocator_t *allocator, apr_size_t size) { - apr_uint32_t max_free_index; + apr_size_t max_free_index; #if APR_HAS_THREADS apr_thread_mutex_t *mutex; @@ -168,7 +168,7 @@ apr_memnode_t *allocator_alloc(apr_allocator_t *allocator, apr_size_t size) { apr_memnode_t *node, **ref; - apr_uint32_t i, index, max_index; + apr_size_t i, index, max_index; /* Round up the block size to the next boundary, but always * allocate at least a certain size (MIN_ALLOC). @@ -304,8 +304,8 @@ void allocator_free(apr_allocator_t *allocator, apr_memnode_t *node) { apr_memnode_t *next, *freelist = NULL; - apr_uint32_t index, max_index; - apr_uint32_t max_free_index, current_free_index; + apr_size_t index, max_index; + apr_size_t max_free_index, current_free_index; #if APR_HAS_THREADS if (allocator->mutex) @@ -582,7 +582,7 @@ { apr_memnode_t *active, *node; void *mem; - apr_uint32_t free_index; + apr_size_t free_index; size = APR_ALIGN_DEFAULT(size); active = pool->active; @@ -877,7 +877,7 @@ apr_size_t cur_len, size; char *strp; apr_pool_t *pool; - apr_uint32_t free_index; + apr_size_t free_index; pool = ps->pool; active = ps->node; @@ -948,7 +948,7 @@ char *strp; apr_size_t size; apr_memnode_t *active, *node; - apr_uint32_t free_index; + apr_size_t free_index; ps.node = active = pool->active; ps.pool = pool; Index: apr-util/buckets/apr_buckets_alloc.c =================================================================== RCS file: /home/cvs/apr-util/buckets/apr_buckets_alloc.c,v retrieving revision 1.16 diff -U3 -r1.16 apr_buckets_alloc.c --- apr-util/buckets/apr_buckets_alloc.c 10 Aug 2004 22:00:16 -0000 1.16 +++ apr-util/buckets/apr_buckets_alloc.c 30 Sep 2004 15:09:59 -0000 @@ -16,7 +16,7 @@ #include #include "apr_buckets.h" -#include "apr_allocator.h" +#include "arch/unix/apr_arch_allocator.h" #define ALLOC_AMT (8192 - APR_MEMNODE_T_SIZE) --------------050808060203020100070100 Content-Type: text/plain; name="apr_arch_allocator.h" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="apr_arch_allocator.h" LyogQ29weXJpZ2h0IDIwMDAtMjAwNCBUaGUgQXBhY2hlIFNvZnR3YXJlIEZvdW5kYXRpb24N CiAqDQogKiBMaWNlbnNlZCB1bmRlciB0aGUgQXBhY2hlIExpY2Vuc2UsIFZlcnNpb24gMi4w ICh0aGUgIkxpY2Vuc2UiKTsNCiAqIHlvdSBtYXkgbm90IHVzZSB0aGlzIGZpbGUgZXhjZXB0 IGluIGNvbXBsaWFuY2Ugd2l0aCB0aGUgTGljZW5zZS4NCiAqIFlvdSBtYXkgb2J0YWluIGEg Y29weSBvZiB0aGUgTGljZW5zZSBhdA0KICoNCiAqICAgICBodHRwOi8vd3d3LmFwYWNoZS5v cmcvbGljZW5zZXMvTElDRU5TRS0yLjANCiAqDQogKiBVbmxlc3MgcmVxdWlyZWQgYnkgYXBw bGljYWJsZSBsYXcgb3IgYWdyZWVkIHRvIGluIHdyaXRpbmcsIHNvZnR3YXJlDQogKiBkaXN0 cmlidXRlZCB1bmRlciB0aGUgTGljZW5zZSBpcyBkaXN0cmlidXRlZCBvbiBhbiAiQVMgSVMi IEJBU0lTLA0KICogV0lUSE9VVCBXQVJSQU5USUVTIE9SIENPTkRJVElPTlMgT0YgQU5ZIEtJ TkQsIGVpdGhlciBleHByZXNzIG9yIGltcGxpZWQuDQogKiBTZWUgdGhlIExpY2Vuc2UgZm9y IHRoZSBzcGVjaWZpYyBsYW5ndWFnZSBnb3Zlcm5pbmcgcGVybWlzc2lvbnMgYW5kDQogKiBs aW1pdGF0aW9ucyB1bmRlciB0aGUgTGljZW5zZS4NCiAqLw0KDQojaWZuZGVmIEFQUl9BUkNI X0FMTE9DQVRPUl9IDQojZGVmaW5lIEFQUl9BUkNIX0FMTE9DQVRPUl9IDQoNCiNpbmNsdWRl ICJhcHJ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