apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yla...@apache.org
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 GMT
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);
 }
 



Mime
View raw message