Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 9C259200C3C for ; Mon, 3 Apr 2017 12:50:47 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 9A72E160B8F; Mon, 3 Apr 2017 10:50:47 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E1244160B76 for ; Mon, 3 Apr 2017 12:50:46 +0200 (CEST) Received: (qmail 70215 invoked by uid 500); 3 Apr 2017 10:50:46 -0000 Mailing-List: contact commits-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: Reply-To: dev@apr.apache.org List-Id: Delivered-To: mailing list commits@apr.apache.org Received: (qmail 70206 invoked by uid 99); 3 Apr 2017 10:50:46 -0000 Received: from Unknown (HELO svn01-us-west.apache.org) (209.188.14.144) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Apr 2017 10:50:46 +0000 Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 7AAB53A04FA for ; Mon, 3 Apr 2017 10:50:45 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1789947 - in /apr/apr/trunk: buckets/apr_buckets_alloc.c buckets/apr_buckets_file.c include/apr_allocator.h include/apr_buckets.h memory/unix/apr_pools.c Date: Mon, 03 Apr 2017 10:50:45 -0000 To: commits@apr.apache.org From: ylavic@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20170403105045.7AAB53A04FA@svn01-us-west.apache.org> archived-at: Mon, 03 Apr 2017 10:50:47 -0000 Author: ylavic Date: Mon Apr 3 10:50:44 2017 New Revision: 1789947 URL: http://svn.apache.org/viewvc?rev=1789947&view=rev Log: Follow up to r1788334: apr_allocator_align() should take an allocator as argument, for better scalability of the API. Update apr_bucket_alloc_aligned_floor() from r1788335 accordingly. Suggested by ivan. Modified: apr/apr/trunk/buckets/apr_buckets_alloc.c apr/apr/trunk/buckets/apr_buckets_file.c apr/apr/trunk/include/apr_allocator.h apr/apr/trunk/include/apr_buckets.h apr/apr/trunk/memory/unix/apr_pools.c Modified: apr/apr/trunk/buckets/apr_buckets_alloc.c URL: http://svn.apache.org/viewvc/apr/apr/trunk/buckets/apr_buckets_alloc.c?rev=1789947&r1=1789946&r2=1789947&view=diff ============================================================================== --- apr/apr/trunk/buckets/apr_buckets_alloc.c (original) +++ apr/apr/trunk/buckets/apr_buckets_alloc.c Mon Apr 3 10:50:44 2017 @@ -123,17 +123,19 @@ APR_DECLARE_NONSTD(void) apr_bucket_allo #endif } -APR_DECLARE_NONSTD(apr_size_t) apr_bucket_alloc_aligned_floor(apr_size_t size) +APR_DECLARE_NONSTD(apr_size_t) apr_bucket_alloc_aligned_floor(apr_bucket_alloc_t *list, + apr_size_t size) { if (size <= SMALL_NODE_SIZE) { size = SMALL_NODE_SIZE; } else { if (size < APR_MEMNODE_T_SIZE) { - size = apr_allocator_align(0); + size = apr_allocator_align(list->allocator, 0); } else { - size = apr_allocator_align(size - APR_MEMNODE_T_SIZE); + size = apr_allocator_align(list->allocator, + size - APR_MEMNODE_T_SIZE); } size -= APR_MEMNODE_T_SIZE; } Modified: apr/apr/trunk/buckets/apr_buckets_file.c URL: http://svn.apache.org/viewvc/apr/apr/trunk/buckets/apr_buckets_file.c?rev=1789947&r1=1789946&r2=1789947&view=diff ============================================================================== --- apr/apr/trunk/buckets/apr_buckets_file.c (original) +++ apr/apr/trunk/buckets/apr_buckets_file.c Mon Apr 3 10:50:44 2017 @@ -205,7 +205,7 @@ APR_DECLARE(apr_status_t) apr_bucket_fil a->read_size = APR_BUCKET_BUFF_SIZE; } else { - apr_size_t floor = apr_bucket_alloc_aligned_floor(size); + apr_size_t floor = apr_bucket_alloc_aligned_floor(e->list, size); a->read_size = (size < floor) ? size : floor; } Modified: apr/apr/trunk/include/apr_allocator.h URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_allocator.h?rev=1789947&r1=1789946&r2=1789947&view=diff ============================================================================== --- apr/apr/trunk/include/apr_allocator.h (original) +++ apr/apr/trunk/include/apr_allocator.h Mon Apr 3 10:50:44 2017 @@ -122,10 +122,12 @@ APR_DECLARE(apr_status_t) apr_allocator_ /** * Get the true size that would be allocated for the given size (including * the header and alignment). + * @param list The allocator from which to the memory would be allocated * @param size The size to align * @return The aligned size (or zero on apr_size_t overflow) */ -APR_DECLARE(apr_size_t) apr_allocator_align(apr_size_t size); +APR_DECLARE(apr_size_t) apr_allocator_align(apr_allocator_t *allocator, + apr_size_t size); #include "apr_pools.h" Modified: apr/apr/trunk/include/apr_buckets.h URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_buckets.h?rev=1789947&r1=1789946&r2=1789947&view=diff ============================================================================== --- apr/apr/trunk/include/apr_buckets.h (original) +++ apr/apr/trunk/include/apr_buckets.h Mon Apr 3 10:50:44 2017 @@ -997,10 +997,13 @@ APR_DECLARE_NONSTD(void) apr_bucket_allo * Get the aligned size corresponding to the requested size, but minus the * allocator(s) overhead such that the allocation would remain in the * same boundary. + * @param list The allocator from which to the memory would be allocated. * @param size The requested size. * @return The corresponding aligned/floored size. */ -APR_DECLARE_NONSTD(apr_size_t) apr_bucket_alloc_aligned_floor(apr_size_t size); +APR_DECLARE_NONSTD(apr_size_t) apr_bucket_alloc_aligned_floor(apr_bucket_alloc_t *list, + apr_size_t size) + __attribute__((nonnull(1))); /** * Allocate memory for use by the buckets. Modified: apr/apr/trunk/memory/unix/apr_pools.c URL: http://svn.apache.org/viewvc/apr/apr/trunk/memory/unix/apr_pools.c?rev=1789947&r1=1789946&r2=1789947&view=diff ============================================================================== --- apr/apr/trunk/memory/unix/apr_pools.c (original) +++ apr/apr/trunk/memory/unix/apr_pools.c Mon Apr 3 10:50:44 2017 @@ -260,8 +260,10 @@ apr_size_t allocator_align(apr_size_t in return size; } -APR_DECLARE(apr_size_t) apr_allocator_align(apr_size_t size) +APR_DECLARE(apr_size_t) apr_allocator_align(apr_allocator_t *allocator, + apr_size_t size) { + (void)allocator; return allocator_align(size); }