apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Erenkrantz <jerenkra...@ebuilt.com>
Subject Re: Memory Renaming (try 2)
Date Sat, 12 May 2001 10:31:44 GMT
Ah heck, since I looked at the code and couldn't make heads or tails
of it in its current format, I applied the name changes discussed in this
thread locally.  That made it easier to review.  If that patch (see below) 
can save someone else time, all the better.  =)  If I misunderstood the
intention of the renaming, ignore the patch at the end then.  It helped
me review the intention of the memory system code, so it served my purposes.

Since the build doesn't generate the makefiles for memory (and am too tired 
to dig around myself and get it to do it right now), I can't tell you 
whether the original code or my renamed code compiles.

My comments:
1) Said before, but asserts are yucky.  Once we have it compiling and
   working, this will be critical to remove.
2) From the performance standpoint, we need to make this malloc stuff as 
   fast as the plain malloc call or this isn't going to be worth much.  
   Checks such as "if !size return 0" probably isn't needed in 
   apr_sms_malloc() code.
3) There is some logic that you are attempting to duplicate in 
   apr_sms_realloc() that I believe the realloc system call handles for you 
   (at least on Solaris).  More generally, you are *probably* better off 
   letting the system calls handle this type of redirection rather than 
   yourself, but I might be wrong.  Dean may have a better idea whether we 
   should try to outsmart the system calls or not - my gut feeling would be
   to avoid this "cleverness."  (You also try to be "safe" about a memset
   call - if memset is bogus, we have lots of other problems...)
4) The function and type rename is a good step, but I'd probably like to
   see shorter local variable names.  Makes for some long lines that have 
   odd wrapping properties.  This isn't my code, so it's not a big deal to 
   me.  Longer variables names are *slightly* better than completely 
   cryptic variable names...
5) What do you plan apr_sms_threadsafe_lock to do (maybe you talked about
   this, but I missed it)?  Is this something similar to apr_lock? Why are 
   we concerned about an apr_sms_t being shared across threads?  (Please 
   don't tell me shared memory segments...)
6) Somewhere there is a bunch of if, else if statements that are
   separated by a bunch of blank lines.  Yuck.  (apr_memory_system.c around 
   line 400.)
7) Why is this stuff in memory/unix?  Wouldn't most of this work on Win32, 
   etc.?  ANSI C requires most of the stuff you are using in apr_sms_std
   (malloc, free, etc.).  But, I could be missing something.
8) Someone with karma should probably rename the files to match the
   appropriate names (apr_sms.h, etc.).
9) Why is apr_tracking_memory_system.h separated out?  This patch
   pulls it back in to (what should be) apr_sms.h.  I can't figure out
   any logical reason why apr_tracking_memory_system.h exists.

My $.02.  It's 3:30AM in the morning here, so if this post doesn't make 
much sense, that's probably why.  -- justin

Index: include/apr_memory_system.h
===================================================================
RCS file: /home/cvspublic/apr/include/apr_memory_system.h,v
retrieving revision 1.4
diff -u -r1.4 apr_memory_system.h
--- include/apr_memory_system.h	2001/05/10 10:33:09	1.4
+++ include/apr_memory_system.h	2001/05/12 10:04:36
@@ -66,32 +66,31 @@
  * @package APR memory system
  */
 
-typedef struct apr_memory_system_t apr_memory_system_t;
+typedef struct apr_sms_t apr_sms_t;
 
-struct apr_memory_system_cleanup;
+struct apr_sms_cleanup;
 
 /**
  * The memory system structure
  */
-struct apr_memory_system_t
+struct apr_sms_t
 {
-  apr_memory_system_t  *parent_memory_system;
-  apr_memory_system_t  *child_memory_system;
-  apr_memory_system_t  *sibling_memory_system;
-  apr_memory_system_t **ref_memory_system;
-  apr_memory_system_t  *accounting_memory_system;
-
-  struct apr_memory_system_cleanup *cleanups;
-
-  void * (*malloc_fn)(apr_memory_system_t *memory_system, apr_size_t size);
-  void * (*realloc_fn)(apr_memory_system_t *memory_system, void *memory, 
-		       apr_size_t size);
-  apr_status_t (*free_fn)(apr_memory_system_t *memory_system, void *memory);
-  apr_status_t (*reset_fn)(apr_memory_system_t *memory_system);
-  void (*pre_destroy_fn)(apr_memory_system_t *memory_system);
-  void (*destroy_fn)(apr_memory_system_t *memory_system);
-  void (*threadsafe_lock_fn)(apr_memory_system_t *memory_system);
-  void (*threadsafe_unlock_fn)(apr_memory_system_t *memory_system);
+    apr_sms_t  *parent_sms;
+    apr_sms_t  *child_sms;
+    apr_sms_t  *sibling_sms;
+    apr_sms_t **ref_sms;
+    apr_sms_t  *accounting_sms;
+
+    struct apr_sms_cleanup *cleanups;
+
+    void * (*malloc_fn)(apr_sms_t *sms, apr_size_t size);
+    void * (*realloc_fn)(apr_sms_t *sms, void *memory, apr_size_t size);
+    apr_status_t (*free_fn)(apr_sms_t *sms, void *memory);
+    apr_status_t (*reset_fn)(apr_sms_t *sms);
+    void (*pre_destroy_fn)(apr_sms_t *sms);
+    void (*destroy_fn)(apr_sms_t *sms);
+    void (*threadsafe_lock_fn)(apr_sms_t *sms);
+    void (*threadsafe_unlock_fn)(apr_sms_t *sms);
 };
 
 /*
@@ -100,45 +99,36 @@
 
 /**
  * Allocate a block of memory using a certain memory system
- * @param memory_system The memory system to use
+ * @param sms The memory system to use
  * @param size The (minimal required) size of the block to be allocated
  * @return pointer to a newly allocated block of memory, NULL if insufficient
  *         memory available
- * @deffunc void *apr_memory_system_malloc(apr_memory_system_t *memory_system,
- *					   apr_size_t size)
+ * @deffunc void *apr_sms_malloc(apr_sms_t *sms, apr_size_t size)
  */
-APR_DECLARE(void *) 
-apr_memory_system_malloc(apr_memory_system_t *memory_system, 
-                         apr_size_t size);
+APR_DECLARE(void *) apr_sms_malloc(apr_sms_t *sms, apr_size_t size);
 
 /**
  * Change the size of a previously allocated block of memory
- * @param memory_system The memory system to use (should be the same as the
+ * @param sms The memory system to use (should be the same as the
  *        one that returned the block)
  * @param mem Pointer to the previously allocated block. If NULL, this
- *        function acts like apr_memory_system_malloc.
+ *        function acts like apr_sms_malloc.
  * @param size The (minimal required) size of the block to be allocated
  * @return pointer to a newly allocated block of memory, NULL if insufficient
  *         memory available
- * @deffunc void *apr_memory_system_realloc(apr_memory_system_t *memory_system,
- *					    void *mem, apr_size_t size)
+ * @deffunc void *apr_sms_realloc(apr_sms_t *sms, void *mem, apr_size_t size)
  */
-APR_DECLARE(void *) 
-apr_memory_system_realloc(apr_memory_system_t *memory_system, 
-                          void *mem,
-                          apr_size_t size);
+APR_DECLARE(void *) apr_sms_realloc(apr_sms_t *sms, void *mem, 
+                                    apr_size_t size);
 
 /**
  * Free a block of memory
- * @param memory_system The memory system to use (should be the same as the
+ * @param sms The memory system to use (should be the same as the
  *        one that returned the block)
  * @param mem The block of memory to be freed
- * @deffunc void apr_memory_system_free(apr_memory_system_t *memory_system,
- *					void *mem)
+ * @deffunc void apr_sms_free(apr_sms_t *sms, void *mem)
  */
-APR_DECLARE(apr_status_t)
-apr_memory_system_free(apr_memory_system_t *memory_system,
-                       void *mem);
+APR_DECLARE(apr_status_t) apr_sms_free(apr_sms_t *sms, void *mem);
 
 /*
  * memory system functions
@@ -148,34 +138,31 @@
  * Create a memory system (actually it initialized a memory system structure)
  * @caution Call this function as soon as you have obtained a block of memory
  *          to serve as a memory system structure from your 
- *          apr_xxx_memory_system_create. Only use this function when you are
+ *          apr_xxx_sms_create. Only use this function when you are
  *          implementing a memory system.
  * @param memory The memory to turn into a memory system
  * @warning The memory passed in should be at least of size 
- *          sizeof(apr_memory_system_t)
- * @param parent_memory_system The parent memory system
+ *          sizeof(apr_sms_t)
+ * @param parent_sms The parent memory system
  * @return The freshly initialized memory system
- * @deffunc apr_memory_system_t *apr_memory_system_create(void *memory,
- *				   apr_memory_system_t *parent_memory_system)
+ * @deffunc apr_sms_t *apr_sms_create(void *memory,
+ *				   apr_sms_t *parent_sms)
  */
-APR_DECLARE(apr_memory_system_t *)
-apr_memory_system_create(void *memory, 
-                         apr_memory_system_t *parent_memory_system);
+APR_DECLARE(apr_sms_t *) apr_sms_create(void *memory, apr_sms_t *parent_sms);
 
 /**
  * Check if a memory system is obeying all rules. 
  * @caution Call this function as the last statement before returning a new
- *          memory system from your apr_xxx_memory_system_create.
- * @deffunc void apr_memory_system_validate(apr_memory_system_t *memory_system)
+ *          memory system from your apr_xxx_sms_create.
+ * @deffunc void apr_sms_validate(apr_sms_t *sms)
  */
 #ifdef APR_MEMORY_SYSTEM_DEBUG
-APR_DECLARE(void) 
-apr_memory_system_assert(apr_memory_system_t *memory_system);
+APR_DECLARE(void) apr_sms_assert(apr_sms_t *sms);
 #else
-#ifdef apr_memory_system_assert
-#undef apr_memory_system_assert
+#ifdef apr_sms_assert
+#undef apr_sms_assert
 #endif
-#define apr_memory_system_assert(memory_system)
+#define apr_sms_assert(sms)
 #endif /* APR_MEMORY_SYSTEM_DEBUG */
 
 /**
@@ -184,50 +171,45 @@
  * @warning This function will fail if there is no reset function available
  *          for the given memory system (i.e. the memory system is non-
  *          tracking).
- * @param memory_system The memory system to be reset
- * @deffunc apr_status_t apr_memory_system_reset(apr_memory_system_t *memory_system)
+ * @param sms The memory system to be reset
+ * @deffunc apr_status_t apr_sms_reset(apr_sms_t *sms)
  */
-APR_DECLARE(apr_status_t)
-apr_memory_system_reset(apr_memory_system_t *memory_system);
+APR_DECLARE(apr_status_t) apr_sms_reset(apr_sms_t *sms);
 
 /**
  * Destroy a memory system, effectively freeing all of its memory, and itself. 
  * This will also run all cleanup functions associated with the memory system.
  * @caution Be carefull when using this function with a non-tracking memory
  *          system
- * @param memory_system The memory system to be destroyed
- * @deffunc apr_status_t apr_memory_system_destroy(apr_memory_system_t *memory_system)
+ * @param sms The memory system to be destroyed
+ * @deffunc apr_status_t apr_sms_destroy(apr_sms_t *sms)
  */
-APR_DECLARE(apr_status_t)
-apr_memory_system_destroy(apr_memory_system_t *memory_system);
+APR_DECLARE(apr_status_t) apr_sms_destroy(apr_sms_t *sms);
 
 /**
  * Perform thread-safe locking required whilst this memory system is modified
- * @param memory_system The memory system to be locked for thread-safety
- * @deffunc void apr_memory_system_threadsafe_lock(apr_memory_system_t *memory_system)
+ * @param sms The memory system to be locked for thread-safety
+ * @deffunc void apr_sms_threadsafe_lock(apr_sms_t *sms)
  */
-APR_DECLARE(void)
-apr_memory_system_threadsafe_lock(apr_memory_system_t *memory_system);
+APR_DECLARE(void) apr_sms_threadsafe_lock(apr_sms_t *sms);
 
 /**
  * Release thread-safe locking required whilst this memory system was
  * being modified
- * @param memory_system The memory system to be released from thread-safety
- * @deffunc void apr_memory_system_threadsafe_unlock(apr_memory_system_t *memory_system)
+ * @param sms The memory system to be released from thread-safety
+ * @deffunc void apr_sms_threadsafe_unlock(apr_sms_t *sms)
  */
-APR_DECLARE(void)
-apr_memory_system_threadsafe_unlock(apr_memory_system_t *memory_system);
+APR_DECLARE(void) apr_sms_threadsafe_unlock(apr_sms_t *sms);
 
 /**
  * Determine if memory system a is an ancestor of memory system b
  * @param a The memory system to search
  * @param b The memory system to search for
  * @return APR_SUCCESS if a is an ancestor of b, 1 if it isn't
- * @deffunc apr_status_t apr_memory_system_is_ancestor(apr_memory_system_t *a,
- *						     apr_memory_system_t *b)
+ * @deffunc apr_status_t apr_sms_is_ancestor(apr_sms_t *a,
+ *						     apr_sms_t *b)
  */
-APR_DECLARE(apr_status_t) 
-apr_memory_system_is_ancestor(apr_memory_system_t *a, apr_memory_system_t *b);
+APR_DECLARE(apr_status_t) apr_sms_is_ancestor(apr_sms_t *a, apr_sms_t *b);
 
 /*
  * memory system cleanup management functions
@@ -235,56 +217,54 @@
 
 /**
  * Register a function to be called when a memory system is reset or destroyed
- * @param memory_system The memory system to register the cleanup function with
+ * @param sms The memory system to register the cleanup function with
  * @param data The data to pass to the cleanup function
  * @param cleanup_fn The function to call when the memory system is reset or
  *        destroyed
- * @deffunc void apr_memory_system_cleanup_register(apr_memory_system_t *memory_system,
+ * @deffunc void apr_sms_cleanup_register(apr_sms_t *sms,
  *		   void *data, apr_status_t (*cleanup_fn)(void *));
  */
-APR_DECLARE(apr_status_t) 
-apr_memory_system_cleanup_register(apr_memory_system_t *memory_system, 
-                                   void *data, 
-                                   apr_status_t (*cleanup_fn)(void *));
+APR_DECLARE(apr_status_t) apr_sms_cleanup_register(apr_sms_t *sms, void *data, 
+                                           apr_status_t (*cleanup_fn)(void *));
 
 /**
  * Unregister a previously registered cleanup function
- * @param memory_system The memory system the cleanup function is registered
+ * @param sms The memory system the cleanup function is registered
  *        with
  * @param data The data associated with the cleanup function
  * @param cleanup_fn The registered cleanup function
- * @deffunc void apr_memory_system_cleanup_unregister(apr_memory_system_t *memory_system,
+ * @deffunc void apr_sms_cleanup_unregister(apr_sms_t *sms,
  *		   void *data, apr_status_t (*cleanup_fn)(void *));
  */
-APR_DECLARE(apr_status_t)
-apr_memory_system_cleanup_unregister(apr_memory_system_t *memory_system,
-                                     void *data,
-                                     apr_status_t (*cleanup)(void *));
+APR_DECLARE(apr_status_t) apr_sms_cleanup_unregister(apr_sms_t *sms, 
+                                                     void *data,
+                                              apr_status_t (*cleanup)(void *));
 
 /**
  * Run the specified cleanup function immediately and unregister it
- * @param memory_system The memory system the cleanup function is registered
+ * @param sms The memory system the cleanup function is registered
  *        with
  * @param data The data associated with the cleanup function
  * @param cleanup The registered cleanup function
- * @deffunc apr_status_t apr_memory_system_cleanup_run(apr_memory_system_t *memory_system,
+ * @deffunc apr_status_t apr_sms_cleanup_run(apr_sms_t *sms,
  *			   void *data, apr_status_t (*cleanup)(void *));
  */
-APR_DECLARE(apr_status_t) 
-apr_memory_system_cleanup_run(apr_memory_system_t *memory_system,
-                              void *data,
-                              apr_status_t (*cleanup)(void *));
+APR_DECLARE(apr_status_t) apr_sms_cleanup_run(apr_sms_t *sms, void *data,
+                                              apr_status_t (*cleanup)(void *));
 
 /**
  * Create a standard malloc/realloc/free memory system
  */
-APR_DECLARE(apr_status_t)
-apr_standard_memory_system_create(apr_memory_system_t **memory_system);
+APR_DECLARE(apr_status_t) apr_sms_std_create(apr_sms_t **sms);
 
+/**
+ * Create a tracking malloc/realloc/free memory system
+ */
+APR_DECLARE(apr_status_t) apr_sms_tracking_create(apr_sms_t **sms,
+				                                  apr_sms_t *parent_sms);
 
 #ifdef __cplusplus
 }
 #endif
 
 #endif /* !APR_MEMORY_SYSTEM_H */
-
Index: memory/unix/apr_memory_system.c
===================================================================
RCS file: /home/cvspublic/apr/memory/unix/apr_memory_system.c,v
retrieving revision 1.3
diff -u -r1.3 apr_memory_system.c
--- memory/unix/apr_memory_system.c	2001/05/10 10:33:13	1.3
+++ memory/unix/apr_memory_system.c	2001/05/12 10:04:40
@@ -60,7 +60,7 @@
  
 #include "apr.h"
 #include "apr_general.h"
-#include "apr_memory_system.h"
+#include "apr_sms.h"
 #include <stdlib.h>
 #include <assert.h>
 
@@ -69,11 +69,11 @@
                      */
 
 /*
- * private structure defenitions
+ * private structure definitions
  */
-struct apr_memory_system_cleanup
+struct apr_sms_cleanup
 {
-    struct apr_memory_system_cleanup *next;
+    struct apr_sms_cleanup *next;
     void *data;
     apr_status_t (*cleanup_fn)(void *);
 };
@@ -82,56 +82,49 @@
  * memory allocation functions
  */
 
-APR_DECLARE(void *)
-apr_memory_system_malloc(apr_memory_system_t *memory_system,
-                         apr_size_t size)
+APR_DECLARE(void *) apr_sms_malloc(apr_sms_t *sms, apr_size_t size)
 {
-    assert(memory_system != NULL);
-    assert(memory_system->malloc_fn != NULL);
+    assert(sms != NULL);
+    assert(sms->malloc_fn != NULL);
  
     if (size == 0)
         return NULL;
 
-    return memory_system->malloc_fn(memory_system, size);
+    return sms->malloc_fn(sms, size);
 }
 
-APR_DECLARE(void *)
-apr_memory_system_realloc(apr_memory_system_t *memory_system,
-                          void *mem,
-                          apr_size_t size)
+APR_DECLARE(void *) apr_sms_realloc(apr_sms_t *sms, void *mem, apr_size_t size)
 {
-    assert(memory_system != NULL);
-    assert(memory_system->realloc_fn != NULL);
+    assert(sms != NULL);
+    assert(sms->realloc_fn != NULL);
 
     if (mem == NULL)
-        return apr_memory_system_malloc(memory_system, size);
+        return apr_sms_malloc(sms, size);
 
     if (size == 0)
     {
-        apr_memory_system_free(memory_system, mem);
+        apr_sms_free(sms, mem);
         return NULL;
     }
 
-    return memory_system->realloc_fn(memory_system, mem, size);
+    return sms->realloc_fn(sms, mem, size);
 }
 
-APR_DECLARE(apr_status_t)
-apr_memory_system_free(apr_memory_system_t *memory_system,
-                       void *mem)
+APR_DECLARE(apr_status_t) apr_sms_free(apr_sms_t *sms, void *mem)
 {
-    assert(memory_system != NULL);
+    assert(sms != NULL);
   
     if (mem == NULL)
         return APR_EINVAL; /* Hmm, is this an error??? */
 
-    if (memory_system->free_fn != NULL)
-        return memory_system->free_fn(memory_system, mem);  
+    if (sms->free_fn != NULL)
+        return sms->free_fn(sms, mem);  
 
 #ifdef APR_MEMORY_SYSTEM_DEBUG
     else /* assume this is a tracking memory system */
     {
         /* issue a warning: 
-         * WARNING: Called apr_memory_system_free() on a tracking memory system
+         * WARNING: Called apr_sms_free() on a tracking memory system
          */
     }
 #endif /* APR_MEMORY_SYSTEM_DEBUG */
@@ -142,65 +135,53 @@
  * memory system functions
  */
 
-static int apr_memory_system_is_tracking(apr_memory_system_t *memory_system)
+static int apr_sms_is_tracking(apr_sms_t *sms)
 {
     /*
      * The presense of a reset function gives us the clue that this is a 
      * tracking memory system.
      */
-    return memory_system->reset_fn != NULL;
+    return sms->reset_fn != NULL;
 }
 
-APR_DECLARE(apr_memory_system_t *)
-apr_memory_system_create(void *memory, 
-                         apr_memory_system_t *parent_memory_system)
+APR_DECLARE(apr_sms_t *) apr_sms_create(void *memory, apr_sms_t *parent_sms)
 {
-    apr_memory_system_t *memory_system;
+    apr_sms_t *sms;
 
     if (memory == NULL)
         return NULL;
 
     /* Just typecast it, and clear it */
-    memory_system = (apr_memory_system_t *)memory;
-    memset(memory_system, '\0', sizeof(apr_memory_system_t));
+    sms = (apr_sms_t*)memory;
+    memset(sms, '\0', sizeof(apr_sms_t));
 
     /* Initialize the parent and accounting memory system pointers */
-    memory_system->parent_memory_system = parent_memory_system;
-    memory_system->accounting_memory_system = memory_system;
+    sms->parent_sms = parent_sms;
+    sms->accounting_sms = sms;
 
-    if (parent_memory_system != NULL)
+    if (parent_sms != NULL)
     {
-        if ((memory_system->sibling_memory_system = 
-           parent_memory_system->child_memory_system) != NULL)
+        if ((sms->sibling_sms = 
+           parent_sms->child_sms) != NULL)
         {
-            memory_system->sibling_memory_system->ref_memory_system = 
-              &memory_system->sibling_memory_system;
+            sms->sibling_sms->ref_sms = &sms->sibling_sms;
         }
-        memory_system->ref_memory_system = 
-          &parent_memory_system->child_memory_system;
-        parent_memory_system->child_memory_system = memory_system;
+        sms->ref_sms = &parent_sms->child_sms;
+        parent_sms->child_sms = sms;
     }
-    /* This seems a bit redundant, but we're not taking chances */
-    else
-    {
-        memory_system->ref_memory_system = NULL;
-        memory_system->sibling_memory_system = NULL;
-        memory_system->child_memory_system = NULL;
-    }
 
-    return memory_system;
+    return sms;
 }
 
 #ifdef APR_MEMORY_SYSTEM_DEBUG
-APR_DECLARE(void) 
-apr_memory_system_assert(apr_memory_system_t *memory_system)
+APR_DECLARE(void) apr_sms_assert(apr_sms_t *sms)
 {
-    apr_memory_system_t *parent;
+    apr_sms_t *parent;
 
     /*
      * A memory system without a malloc won't do us much good
      */
-    assert(memory_system->malloc_fn != NULL);
+    assert(sms->malloc_fn != NULL);
 
     /* 
      * Check to see if this is either a non-tracking or
@@ -208,24 +189,20 @@
      * or destroy function. And to avoid half implementations
      * we require reset to be present when destroy is.
      */
-    assert(memory_system->free_fn != NULL ||
-         (memory_system->destroy_fn != NULL &&
-          memory_system->reset_fn != NULL));
+    assert(sms->free_fn != NULL || 
+           (sms->destroy_fn != NULL && sms->reset_fn != NULL));
 
-    assert(memory_system->destroy_fn == NULL ||
-         memory_system->reset_fn != NULL);
+    assert(sms->destroy_fn == NULL || sms->reset_fn != NULL);
   
-    assert(memory_system->reset_fn == NULL ||
-         memory_system->destroy_fn != NULL);
+    assert(sms->reset_fn == NULL || sms->destroy_fn != NULL);
 
     /*
      * Make sure all accounting memory dies with the memory system.
      * To be more specific, make sure the accounting memort system
      * is either the memory system itself or a direct child.
      */
-    assert(memory_system->accounting_memory_system == memory_system ||
-	 memory_system->accounting_memory_system->parent_memory_system == 
-	   memory_system);
+    assert(sms->accounting_sms == sms || 
+           sms->accounting_sms->parent_sms == sms);
 
     /*
      * A non-tracking memory system can be the child of
@@ -233,16 +210,16 @@
      * tracking ancestors, but in that specific case we issue a
      * warning.
      */
-    if (memory_system->parent_memory_system == NULL)
+    if (sms->parent_sms == NULL)
         return;
 
-    parent = memory_system
+    parent = sms
     while (parent)
     {
-        if (apr_memory_system_is_tracking(parent))
+        if (apr_sms_is_tracking(parent))
             return; /* Tracking memory system found, return satisfied ;-) */
 
-        parent = parent->parent_memory_system;
+        parent = parent->parent_sms;
     }
 
     /* issue a warning: 
@@ -254,19 +231,17 @@
 
 /*
  * LOCAL FUNCTION used in:
- *  - apr_memory_system_do_child_cleanups
- *  - apr_memory_system_reset
- *  - apr_memory_system_destroy
+ *  - apr_sms_do_child_cleanups
+ *  - apr_sms_reset
+ *  - apr_sms_destroy
  *
  * Call all the cleanup routines registered with a memory system.
  */
-static
-void
-apr_memory_system_do_cleanups(apr_memory_system_t *memory_system)
+static void apr_sms_do_cleanups(apr_sms_t *sms)
 {
-    struct apr_memory_system_cleanup *cleanup;
+    struct apr_sms_cleanup *cleanup;
 
-    cleanup = memory_system->cleanups;
+    cleanup = sms->cleanups;
     while (cleanup)
     {
         cleanup->cleanup_fn(cleanup->data);
@@ -276,50 +251,47 @@
 
 /*
  * LOCAL FUNCTION used in:
- *  - apr_memory_system_reset
- *  - apr_memory_system_destroy
+ *  - apr_sms_reset
+ *  - apr_sms_destroy
  *
  * This not only calls do_cleanups, but also calls the pre_destroy(!)
  */
-static 
-void 
-apr_memory_system_do_child_cleanups(apr_memory_system_t *memory_system)
+static void apr_sms_do_child_cleanups(apr_sms_t *sms)
 {
-    if (memory_system == NULL)
+    if (sms == NULL)
         return;
 
-    memory_system = memory_system->child_memory_system;
-    while (memory_system)
+    sms = sms->child_sms;
+    while (sms)
     {
-        apr_memory_system_do_child_cleanups(memory_system);
-        apr_memory_system_do_cleanups(memory_system);
+        apr_sms_do_child_cleanups(sms);
+        apr_sms_do_cleanups(sms);
 
-        if (memory_system->pre_destroy_fn != NULL)
-            memory_system->pre_destroy_fn(memory_system);
+        if (sms->pre_destroy_fn != NULL)
+            sms->pre_destroy_fn(sms);
 
-        memory_system = memory_system->sibling_memory_system;
+        sms = sms->sibling_sms;
     }
 }
 
-APR_DECLARE(apr_status_t)
-apr_memory_system_reset(apr_memory_system_t *memory_system)
+APR_DECLARE(apr_status_t) apr_sms_reset(apr_sms_t *sms)
 {
-    assert(memory_system != NULL);
+    assert(sms != NULL);
     /* Assert when called on a non-tracking memory system */
-    assert(memory_system->reset_fn != NULL);
+    assert(sms->reset_fn != NULL);
 
     /* 
      * Run the cleanups of all child memory systems _including_
      * the accounting memory system.
      */
-    apr_memory_system_do_child_cleanups(memory_system);
+    apr_sms_do_child_cleanups(sms);
 
     /* Run all cleanups, the memory will be freed by the reset */
-    apr_memory_system_do_cleanups(memory_system);
-    memory_system->cleanups = NULL;
+    apr_sms_do_cleanups(sms);
+    sms->cleanups = NULL;
 
     /* We don't have any child memory systems after the reset */
-    memory_system->child_memory_system = NULL;
+    sms->child_sms = NULL;
 
     /* Reset the accounting memory system to ourselves, any
      * child memory system _including_ the accounting memory
@@ -327,143 +299,139 @@
      * strikerXXX: Maybe this should be the responsibility of
      *             the reset function(?).
      */
-    memory_system->accounting_memory_system = memory_system;
+    sms->accounting_sms = sms;
 
     /* Let the memory system handle the actual reset */
-    return memory_system->reset_fn(memory_system);
+    return sms->reset_fn(sms);
 }
 
-APR_DECLARE(apr_status_t)
-apr_memory_system_destroy(apr_memory_system_t *memory_system)
+APR_DECLARE(apr_status_t) apr_sms_destroy(apr_sms_t *sms)
 {
-    apr_memory_system_t *child_memory_system;
-    apr_memory_system_t *sibling_memory_system;
-    struct apr_memory_system_cleanup *cleanup;
-    struct apr_memory_system_cleanup *next_cleanup;
+    apr_sms_t *child_sms;
+    apr_sms_t *sibling_sms;
+    struct apr_sms_cleanup *cleanup;
+    struct apr_sms_cleanup *next_cleanup;
 
-    assert(memory_system != NULL);
+    assert(sms != NULL);
 
-    if (apr_memory_system_is_tracking(memory_system))
+    if (apr_sms_is_tracking(sms))
     {
         /* 
          * Run the cleanups of all child memory systems _including_
          * the accounting memory system.
          */
-        apr_memory_system_do_child_cleanups(memory_system);
+        apr_sms_do_child_cleanups(sms);
 
         /* Run all cleanups, the memory will be freed by the destroy */
-        apr_memory_system_do_cleanups(memory_system);
+        apr_sms_do_cleanups(sms);
     }
     else
     {
-        if (memory_system->accounting_memory_system != memory_system)
+        if (sms->accounting_sms != sms)
         {
-            child_memory_system = memory_system->accounting_memory_system;
+            child_sms = sms->accounting_sms;
 		    
             /* 
              * Remove the accounting memory system from the memory systems 
              * child list (we will explicitly destroy it later in this block).
              */
-            if (child_memory_system->sibling_memory_system != NULL)
-	            child_memory_system->sibling_memory_system->ref_memory_system =
-	              child_memory_system->ref_memory_system;
+            if (child_sms->sibling_sms != NULL)
+	            child_sms->sibling_sms->ref_sms = child_sms->ref_sms;
 
-            *child_memory_system->ref_memory_system = 
-            child_memory_system->sibling_memory_system;
+            *child_sms->ref_sms = child_sms->sibling_sms;
 
             /* Set this fields so destroy will work */
-            child_memory_system->ref_memory_system = NULL;
-            child_memory_system->sibling_memory_system = NULL;
+            child_sms->ref_sms = NULL;
+            child_sms->sibling_sms = NULL;
         }
 
         /* Visit all children and destroy them */
-        child_memory_system = memory_system->child_memory_system;
-        while (child_memory_system != NULL)
+        child_sms = sms->child_sms;
+        while (child_sms != NULL)
         {
-            sibling_memory_system = child_memory_system->sibling_memory_system;
-            apr_memory_system_destroy(child_memory_system);
-            child_memory_system = sibling_memory_system;
+            sibling_sms = child_sms->sibling_sms;
+            apr_sms_destroy(child_sms);
+            child_sms = sibling_sms;
         }
 
         /*
-         * If the accounting memory system _is_ tracking, we also know that it is
-         * not the memory system itself.
+         * If the accounting memory system _is_ tracking, we also know that it 
+         * is not the memory system itself.
          */
-        if (apr_memory_system_is_tracking(memory_system->accounting_memory_system))
+        if (apr_sms_is_tracking(sms->accounting_sms))
         {
             /* 
-             * Run all cleanups, the memory will be freed by the destroying of the
-             * accounting memory system.
+             * Run all cleanups, the memory will be freed by the destroying of 
+             * the accounting memory system.
              */
-            apr_memory_system_do_cleanups(memory_system);
+            apr_sms_do_cleanups(sms);
 
             /* Destroy the accounting memory system */
-            apr_memory_system_destroy(memory_system->accounting_memory_system);
+            apr_sms_destroy(sms->accounting_sms);
 
             /* 
-             * Set the accounting memory system back to the parent memory system
-             * just in case...
+             * Set the accounting memory system back to the parent memory 
+             * system just in case...
              */
-            memory_system->accounting_memory_system = memory_system;
+            sms->accounting_sms = sms;
         }
         else
         {
             /* Run all cleanups, free'ing memory as we go */
-            cleanup = memory_system->cleanups;
+            cleanup = sms->cleanups;
             while (cleanup)
             {
                 cleanup->cleanup_fn(cleanup->data);
                 next_cleanup = cleanup->next;
-                apr_memory_system_free(memory_system->accounting_memory_system, 
-			       cleanup);
+                apr_sms_free(sms->accounting_sms, cleanup);
                 cleanup = next_cleanup;
             }
 
-            if (memory_system->accounting_memory_system != memory_system)
+            if (sms->accounting_sms != sms)
             {
                 /* Destroy the accounting memory system */
-                apr_memory_system_destroy(memory_system->accounting_memory_system);
+                apr_sms_destroy(sms->accounting_sms);
                 /* 
-                 * Set the accounting memory system back to the parent memory system
-                 * just in case...
+                 * Set the accounting memory system back to the parent memory 
+                 * system just in case...
                  */
-                memory_system->accounting_memory_system = memory_system;
+                sms->accounting_sms = sms;
             }
        }
   }
 
   /* Remove the memory system from the parent memory systems child list */
-  if (memory_system->sibling_memory_system != NULL)
-      memory_system->sibling_memory_system->ref_memory_system =
-        memory_system->ref_memory_system;
-  if (memory_system->ref_memory_system != NULL)
-      *memory_system->ref_memory_system = memory_system->sibling_memory_system;
+  if (sms->sibling_sms != NULL)
+      sms->sibling_sms->ref_sms =
+        sms->ref_sms;
+  if (sms->ref_sms != NULL)
+      *sms->ref_sms = sms->sibling_sms;
 
   /* Call the pre-destroy if present */
-  if (memory_system->pre_destroy_fn != NULL)
-      memory_system->pre_destroy_fn(memory_system);
+  if (sms->pre_destroy_fn != NULL)
+      sms->pre_destroy_fn(sms);
 
   /* 1 - If we have a self destruct, use it */
-  if (memory_system->destroy_fn != NULL)
-      memory_system->destroy_fn(memory_system);
+  if (sms->destroy_fn != NULL)
+      sms->destroy_fn(sms);
 
   /* 2 - If we don't have a parent, free using ourselves */
-  else if (memory_system->parent_memory_system == NULL)
-      memory_system->free_fn(memory_system, memory_system);
+  else if (sms->parent_sms == NULL)
+      sms->free_fn(sms, sms);
 
   /* 3 - If we do have a parent and it has a free function, use it */
-  else if (memory_system->parent_memory_system->free_fn != NULL)
-      apr_memory_system_free(memory_system->parent_memory_system, memory_system);
+  else if (sms->parent_sms->free_fn != NULL)
+      apr_sms_free(sms->parent_sms, sms);
 
   /* 4 - Assume we are the child of a tracking memory system, and do nothing */
 #ifdef APR_MEMORY_SYSTEM_DEBUG
-    memory_system = memory_system->parent_memory_system;
-    while (memory_system)
+    sms = sms->parent_sms;
+    while (sms)
     {
-        if (apr_memory_system_is_tracking(memory_system))
+        if (apr_sms_is_tracking(sms))
             return APR_SUCCESS;
 
-        memory_system = memory_system->parent_memory_system;
+        sms = sms->parent_sms;
     }
 
     assert(0); /* Made the wrong assumption, so we assert */
@@ -471,91 +439,83 @@
     return APR_SUCCESS;
 }
 
-APR_DECLARE(apr_status_t)
-apr_memory_system_is_ancestor(apr_memory_system_t *a,
-                              apr_memory_system_t *b)
+APR_DECLARE(apr_status_t) apr_sms_is_ancestor(apr_sms_t *a, apr_sms_t *b)
 {
     assert(b != NULL);
 
     while (b && b != a)
-        b = b->parent_memory_system;
+        b = b->parent_sms;
 
     /* strikerXXX: should this be: return b == a ? APR_TRUE : APR_FALSE; */
     /* APR_SUCCESS = 0, so if they agree we should return that... */
     return !(b == a); 
 }
 
-APR_DECLARE(void)
-apr_memory_system_threadsafe_lock(apr_memory_system_t *memory_system)
+APR_DECLARE(void) apr_sms_threadsafe_lock(apr_sms_t *sms)
 {
-    assert(memory_system != NULL);
-    if (memory_system->threadsafe_lock_fn != NULL)
-        memory_system->threadsafe_lock_fn(memory_system);
+    assert(sms != NULL);
+    if (sms->threadsafe_lock_fn != NULL)
+        sms->threadsafe_lock_fn(sms);
 }
 
-APR_DECLARE(void)
-apr_memory_system_threadsafe_unlock(apr_memory_system_t *memory_system)
+APR_DECLARE(void) apr_sms_threadsafe_unlock(apr_sms_t *sms)
 {
-    assert(memory_system != NULL);
-    if (memory_system->threadsafe_unlock_fn != NULL)
-        memory_system->threadsafe_unlock_fn(memory_system);
+    assert(sms != NULL);
+    if (sms->threadsafe_unlock_fn != NULL)
+        sms->threadsafe_unlock_fn(sms);
 }
 
 /*
  * memory system cleanup management functions
  */
-
 APR_DECLARE(apr_status_t)
-apr_memory_system_cleanup_register(apr_memory_system_t *memory_system,
-                                   void *data,
-                                   apr_status_t (*cleanup_fn)(void *))
+apr_sms_cleanup_register(apr_sms_t *sms, void *data,
+                         apr_status_t (*cleanup_fn)(void *))
 {
-    struct apr_memory_system_cleanup *cleanup;
+    struct apr_sms_cleanup *cleanup;
 
-    assert(memory_system != NULL);
-    assert(memory_system->accounting_memory_system != NULL);
+    assert(sms != NULL);
+    assert(sms->accounting_sms != NULL);
 
     if (cleanup_fn == NULL)
         return APR_EINVAL;
 
-    cleanup = (struct apr_memory_system_cleanup *)
-	    apr_memory_system_malloc(memory_system->accounting_memory_system,
-				     sizeof(struct apr_memory_system_cleanup));
+    cleanup = (struct apr_sms_cleanup *)
+	    apr_sms_malloc(sms->accounting_sms, sizeof(struct apr_sms_cleanup));
 
     if (cleanup == NULL)
         return APR_ENOMEM;
 
     cleanup->data = data;
     cleanup->cleanup_fn = cleanup_fn;
-    cleanup->next = memory_system->cleanups;
-    memory_system->cleanups = cleanup;
+    cleanup->next = sms->cleanups;
+    sms->cleanups = cleanup;
 
     return APR_SUCCESS;
 }
 
 APR_DECLARE(apr_status_t)
-apr_memory_system_cleanup_unregister(apr_memory_system_t *memory_system,
-                                     void *data,
-                                     apr_status_t (*cleanup_fn)(void *))
+apr_sms_cleanup_unregister(apr_sms_t *sms, void *data,
+                           apr_status_t (*cleanup_fn)(void *))
 {
-    struct apr_memory_system_cleanup *cleanup;
-    struct apr_memory_system_cleanup **cleanup_ref;
+    struct apr_sms_cleanup *cleanup;
+    struct apr_sms_cleanup **cleanup_ref;
 
-    assert(memory_system != NULL);
-    assert(memory_system->accounting_memory_system != NULL);
+    assert(sms != NULL);
+    assert(sms->accounting_sms != NULL);
 
-    cleanup = memory_system->cleanups;
-    cleanup_ref = &memory_system->cleanups;
+    cleanup = sms->cleanups;
+    cleanup_ref = &sms->cleanups;
     while (cleanup)
     {
         if (cleanup->data == data && cleanup->cleanup_fn == cleanup_fn)
         {
             *cleanup_ref = cleanup->next;
 
-            memory_system = memory_system->accounting_memory_system;
+            sms = sms->accounting_sms;
 
-            if (memory_system->free_fn != NULL)
-                apr_memory_system_free(memory_system, cleanup);
+            if (sms->free_fn != NULL)
+                apr_sms_free(sms, cleanup);
 
             return APR_SUCCESS;
         }
@@ -568,11 +528,9 @@
     return APR_ENOCLEANUP;
 }
 
-APR_DECLARE(apr_status_t)
-apr_memory_system_cleanup_run(apr_memory_system_t *memory_system, 
-			      void *data, 
-			      apr_status_t (*cleanup_fn)(void *))
+APR_DECLARE(apr_status_t) apr_sms_cleanup_run(apr_sms_t *sms, void *data, 
+			                                 apr_status_t (*cleanup_fn)(void *))
 {
-    apr_memory_system_cleanup_unregister(memory_system, data, cleanup_fn);
+    apr_sms_cleanup_unregister(sms, data, cleanup_fn);
     return cleanup_fn(data);
 }
Index: memory/unix/apr_standard_memory_system.c
===================================================================
RCS file: /home/cvspublic/apr/memory/unix/apr_standard_memory_system.c,v
retrieving revision 1.3
diff -u -r1.3 apr_standard_memory_system.c
--- memory/unix/apr_standard_memory_system.c	2001/05/11 00:29:23	1.3
+++ memory/unix/apr_standard_memory_system.c	2001/05/12 10:04:40
@@ -61,7 +61,7 @@
 #include "apr.h"
 #include "apr_private.h"
 #include "apr_general.h"
-#include "apr_memory_system.h"
+#include "apr_sms.h"
 #include <stdlib.h>
 #include <assert.h>
 
@@ -69,51 +69,40 @@
  * standard memory system
  */
 
-static 
-void *
-apr_standard_memory_system_malloc(apr_memory_system_t *memory_system,
-                                  apr_size_t size)
+static void * apr_sms_std_malloc(apr_sms_t *sms, apr_size_t size)
 {
     return malloc(size);
 }
 
-static 
-void *
-apr_standard_memory_system_realloc(apr_memory_system_t *memory_system,
-                                   void *mem, apr_size_t size)
+static void * apr_sms_std_realloc(apr_sms_t *sms, void *mem, apr_size_t size)
 {
     return realloc(mem, size);
 }
 
-static 
-apr_status_t
-apr_standard_memory_system_free(apr_memory_system_t *memory_system,
-                                void *mem)
+static apr_status_t apr_sms_std_free(apr_sms_t *sms, void *mem)
 {
     free(mem);
     return APR_SUCCESS;
 }
 
-APR_DECLARE(apr_status_t)
-apr_standard_memory_system_create(apr_memory_system_t **memory_system)
+APR_DECLARE(apr_status_t) apr_sms_std_create(apr_sms_t **sms)
 {
-    apr_memory_system_t *new_memory_system;
+    apr_sms_t *new_sms;
 
-    assert(memory_system != NULL);
+    assert(sms != NULL);
 
-    *memory_system = NULL;
-    new_memory_system = apr_memory_system_create(
-        malloc(sizeof(apr_memory_system_t)), NULL);
+    *sms = NULL;
+    new_sms = apr_sms_create(malloc(sizeof(apr_sms_t)), NULL);
 
-    if (new_memory_system == NULL)
+    if (new_sms == NULL)
         return APR_ENOMEM;
 
-    new_memory_system->malloc_fn = apr_standard_memory_system_malloc;
-    new_memory_system->realloc_fn = apr_standard_memory_system_realloc;
-    new_memory_system->free_fn = apr_standard_memory_system_free;
+    new_sms->malloc_fn = apr_sms_std_malloc;
+    new_sms->realloc_fn = apr_sms_std_realloc;
+    new_sms->free_fn = apr_sms_std_free;
 
-    apr_memory_system_assert(new_memory_system);
+    apr_sms_assert(new_sms);
 
-    *memory_system = new_memory_system;
+    *sms = new_sms;
     return APR_SUCCESS;
 }
Index: memory/unix/apr_tracking_memory_system.c
===================================================================
RCS file: /home/cvspublic/apr/memory/unix/apr_tracking_memory_system.c,v
retrieving revision 1.3
diff -u -r1.3 apr_tracking_memory_system.c
--- memory/unix/apr_tracking_memory_system.c	2001/05/11 00:29:23	1.3
+++ memory/unix/apr_tracking_memory_system.c	2001/05/12 10:04:40
@@ -61,7 +61,7 @@
 #include "apr.h"
 #include "apr_general.h"
 #include "apr_private.h"
-#include "apr_tracking_memory_system.h"
+#include "apr_sms_tracking.h"
 #include <stdlib.h>
 #include <assert.h>
 
@@ -76,31 +76,27 @@
     struct apr_track_node_t **ref;
 } apr_track_node_t;
 
-typedef struct apr_tracking_memory_system_t
+typedef struct apr_sms_tracking_t
 {
-    apr_memory_system_t  header;
+    apr_sms_t  header;
     apr_track_node_t    *nodes;
-} apr_tracking_memory_system_t;
+} apr_sms_tracking_t;
 
-static 
-void *
-apr_tracking_memory_system_malloc(apr_memory_system_t *memory_system,
-                                  apr_size_t size)
+static void * apr_sms_tracking_malloc(apr_sms_t *sms, apr_size_t size)
 {
-    apr_tracking_memory_system_t *tracking_memory_system;
+    apr_sms_tracking_t *sms_tracking;
     apr_track_node_t *node;
   
-    assert (memory_system != NULL);
+    assert (sms != NULL);
 
-    tracking_memory_system = (apr_tracking_memory_system_t *)memory_system;
-    node = apr_memory_system_malloc(memory_system->parent_memory_system,
-				  size + sizeof(apr_track_node_t));
+    sms_tracking = (apr_sms_tracking_t *)sms;
+    node = apr_sms_malloc(sms->parent_sms, size + sizeof(apr_track_node_t));
     if (node == NULL)
         return NULL;
 
-    node->next = tracking_memory_system->nodes;
-    tracking_memory_system->nodes = node;
-    node->ref = &tracking_memory_system->nodes;
+    node->next = sms_tracking->nodes;
+    sms_tracking->nodes = node;
+    node->ref = &sms_tracking->nodes;
     if (node->next != NULL)
         node->next->ref = &node->next;
 
@@ -109,17 +105,15 @@
     return (void *)node;
 }
 
-static 
-void *
-apr_tracking_memory_system_realloc(apr_memory_system_t *memory_system,
-                                   void *mem, apr_size_t size)
+static void * apr_sms_tracking_realloc(apr_sms_t *sms, void *mem, 
+                                       apr_size_t size)
 {
-    apr_tracking_memory_system_t *tracking_memory_system;
+    apr_sms_tracking_t *sms_tracking;
     apr_track_node_t *node;
 
-    assert (memory_system != NULL);
+    assert (sms != NULL);
 
-    tracking_memory_system = (apr_tracking_memory_system_t *)memory_system;
+    sms_tracking = (apr_sms_tracking_t *)sms;
     node = (apr_track_node_t *)mem;
 
     if (node != NULL)
@@ -128,14 +122,14 @@
         *(node->ref) = node->next;
     }
 
-    node = apr_memory_system_realloc(memory_system->parent_memory_system,
-				   node, size + sizeof(apr_track_node_t));
+    node = apr_sms_realloc(sms->parent_sms, node, 
+                           size + sizeof(apr_track_node_t));
     if (node == NULL)
         return NULL;
 
-    node->next = tracking_memory_system->nodes;
-    tracking_memory_system->nodes = node;
-    node->ref = &tracking_memory_system->nodes;
+    node->next = sms_tracking->nodes;
+    sms_tracking->nodes = node;
+    node->ref = &sms_tracking->nodes;
     if (node->next != NULL)
         node->next->ref = &node->next;
 
@@ -144,14 +138,11 @@
     return (void *)node;
 }
 
-static 
-apr_status_t
-apr_tracking_memory_system_free(apr_memory_system_t *memory_system,
-                                void *mem)
+static apr_status_t apr_sms_tracking_free(apr_sms_t *sms, void *mem)
 {
     apr_track_node_t *node;
 
-    assert (memory_system != NULL);
+    assert (sms != NULL);
     assert (mem != NULL);
 
     node = (apr_track_node_t *)mem;
@@ -161,74 +152,68 @@
     if (node->next != NULL)
         node->next->ref = node->ref;
           
-    return apr_memory_system_free(memory_system->parent_memory_system, node);
+    return apr_sms_free(sms->parent_sms, node);
 }
 
-static
-apr_status_t
-apr_tracking_memory_system_reset(apr_memory_system_t *memory_system)
+static apr_status_t
+apr_sms_tracking_reset(apr_sms_t *sms)
 {
-    apr_tracking_memory_system_t *tracking_memory_system;
+    apr_sms_tracking_t *sms_tracking;
     apr_track_node_t *node;
     apr_status_t rv;
     
-    assert (memory_system != NULL);
+    assert (sms != NULL);
 
-    tracking_memory_system = (apr_tracking_memory_system_t *)memory_system;
+    sms_tracking = (apr_sms_tracking_t *)sms;
 
-    while (tracking_memory_system->nodes != NULL)
+    while (sms_tracking->nodes != NULL)
     {
-        node = tracking_memory_system->nodes;
+        node = sms_tracking->nodes;
         *(node->ref) = node->next;
         if (node->next != NULL)
             node->next->ref = node->ref;
-        if ((rv = apr_memory_system_free(memory_system->parent_memory_system,
-                                         node)) != APR_SUCCESS)
+        if ((rv = apr_sms_free(sms->parent_sms, node)) != APR_SUCCESS)
             return rv;
     }
     return APR_SUCCESS;
 }
 
-static
-void
-apr_tracking_memory_system_destroy(apr_memory_system_t *memory_system)
+static void apr_sms_tracking_destroy(apr_sms_t *sms)
 {
-    assert (memory_system != NULL);
+    assert (sms != NULL);
 
-    apr_tracking_memory_system_reset(memory_system);
-    apr_memory_system_free(memory_system->parent_memory_system, memory_system);
+    apr_sms_tracking_reset(sms);
+    apr_sms_free(sms->parent_sms, sms);
 }
 
-APR_DECLARE(apr_status_t)
-apr_tracking_memory_system_create(apr_memory_system_t **memory_system,
-				  apr_memory_system_t *parent_memory_system)
-{
-    apr_memory_system_t *new_memory_system;
-    apr_tracking_memory_system_t *tracking_memory_system;
-
-    assert (memory_system != NULL);
-    assert (parent_memory_system != NULL);
-
-    new_memory_system = apr_memory_system_create(
-        apr_memory_system_malloc(parent_memory_system, 
-                                 sizeof(apr_tracking_memory_system_t)), 
-		parent_memory_system);
+APR_DECLARE(apr_status_t) apr_sms_tracking_create(apr_sms_t **sms, 
+                                                  apr_sms_t *parent_sms)
+{
+    apr_sms_t *new_sms;
+    apr_sms_tracking_t *sms_tracking;
+
+    assert (sms != NULL);
+    assert (parent_sms != NULL);
+
+    new_sms = apr_sms_create(apr_sms_malloc(parent_sms, 
+                                            sizeof(apr_sms_tracking_t)), 
+                             parent_sms);
 
-    *memory_system = NULL;
-    if (new_memory_system == NULL)
+    *sms = NULL;
+    if (new_sms == NULL)
         return APR_ENOMEM;
 
-    new_memory_system->malloc_fn = apr_tracking_memory_system_malloc;
-    new_memory_system->realloc_fn = apr_tracking_memory_system_realloc;
-    new_memory_system->free_fn = apr_tracking_memory_system_free;
-    new_memory_system->reset_fn = apr_tracking_memory_system_reset;
-    new_memory_system->destroy_fn = apr_tracking_memory_system_destroy;
+    new_sms->malloc_fn = apr_sms_tracking_malloc;
+    new_sms->realloc_fn = apr_sms_tracking_realloc;
+    new_sms->free_fn = apr_sms_tracking_free;
+    new_sms->reset_fn = apr_sms_tracking_reset;
+    new_sms->destroy_fn = apr_sms_tracking_destroy;
 
-    tracking_memory_system = (apr_tracking_memory_system_t *)new_memory_system;
-    tracking_memory_system->nodes = NULL;
+    sms_tracking = (apr_sms_tracking_t*) new_sms;
+    sms_tracking->nodes = NULL;
 
-    apr_memory_system_assert(new_memory_system);
+    apr_sms_assert(new_sms);
 
-    *memory_system = new_memory_system;
+    *sms = new_sms;
     return APR_SUCCESS;
 }


Mime
View raw message