I just got bit by apr_parent_get_pool (bad, bad name).

So I've hacked up a example patch for apr_allocator_max_free_set.

First, adding -D APR_STRICT, coders can test that they don't use
deprecated symbols when building their code against apr headers.

Second, if the user defines APR_FAST_COMPAT, they get a much
more optimal code path (either an inline thunk or a simple #define
translation when possible.)  But this code will NOT be backwards
compatible to an older libapr dynamic library.

If the user fails to define APR_FAST_COMPAT, they will link to
a backwards compatible symbol that will bind to any older APR
library with that original symbol, or the current library which will
is a light wrapper around the new function.

Thoughts before I whack lots of functions, and reintroduce some
symbols that should not have been eliminated?

All these symbols will be removed in APR 1.0.0, if I understand
Greg's schema.
Index: include/apr_allocator.h
===================================================================
RCS file: /home/cvs/apr/include/apr_allocator.h,v
retrieving revision 1.7
diff -u -r1.7 apr_allocator.h
--- include/apr_allocator.h     30 May 2002 00:20:56 -0000      1.7
+++ include/apr_allocator.h     7 Jun 2002 17:58:51 -0000
@@ -160,8 +160,20 @@
  * @param allocator The allocator the set the threshold on
  * @param size The threshold.  0 == unlimited.
  */
+APR_DECLARE(void) apr_allocator_max_free_set(apr_allocator_t *allocator,
+                                             apr_size_t size);
+
+#ifndef APR_STRICT
+#ifdef APR_FAST_COMPAT
+#define apr_allocator_set_max_free apr_allocator_max_free_set
+#else
+/**
+ * Deprecated: Use apr_allocator_max_free_set() instead
+ */
 APR_DECLARE(void) apr_allocator_set_max_free(apr_allocator_t *allocator,
                                              apr_size_t size);
+#endif
+#endif
 
 #include "apr_thread_mutex.h"
 
Index: memory/unix/apr_pools.c
===================================================================
RCS file: /home/cvs/apr/memory/unix/apr_pools.c,v
retrieving revision 1.175
diff -u -r1.175 apr_pools.c
--- memory/unix/apr_pools.c     30 May 2002 01:15:29 -0000      1.175
+++ memory/unix/apr_pools.c     7 Jun 2002 17:58:52 -0000
@@ -166,7 +166,7 @@
     return allocator->owner;
 }
 
-APR_DECLARE(void) apr_allocator_set_max_free(apr_allocator_t *allocator,
+APR_DECLARE(void) apr_allocator_max_free_set(apr_allocator_t *allocator,
                                              apr_size_t size)
 {
     apr_uint32_t max_free_index;
@@ -190,6 +190,14 @@
     if (mutex != NULL)
         apr_thread_mutex_unlock(mutex);
 #endif
+}
+
+/* Deprecated
+ */
+APR_DECLARE(void) apr_allocator_set_max_free(apr_allocator_t *allocator,
+                                             apr_size_t size)
+{
+    apr_allocator_max_free_set(allocator, size);
 }
 
 static APR_INLINE

Reply via email to