dreid 01/06/05 02:30:39
Modified: memory/unix apr_sms.c
Log:
Add some explanation of the way that parent/child/sibling relationships
work and tidy up some now uneeded code and a comment who's time has passed...
Submitted by: Sander Striker <[EMAIL PROTECTED]>
Reviewed by: David Reid <[EMAIL PROTECTED]>
Revision Changes Path
1.13 +18 -7 apr/memory/unix/apr_sms.c
Index: apr_sms.c
===================================================================
RCS file: /home/cvs/apr/memory/unix/apr_sms.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- apr_sms.c 2001/06/05 09:23:32 1.12
+++ apr_sms.c 2001/06/05 09:30:37 1.13
@@ -167,19 +167,30 @@
mem_sys->accounting_mem_sys = mem_sys;
mem_sys->child_mem_sys = NULL;
+ /*
+ * Child memory systems are always linked to their parents. This works
+ * as follows...
+ *
+ * parent
+ * |
+ * |
+ * child --- sibling --- sibling --- sibling
+ *
+ * To be able to remove a memory system from a list we also need to
+ * keep a ref pointer (a pointer to the pointer pointing to the memory
+ * system). To remove a memory system, basically...
+ *
+ * *ref = sibling;
+ * if (sibling)
+ * sibling->ref = ref;
+ */
+
if (parent_mem_sys) {
if ((mem_sys->sibling_mem_sys = parent_mem_sys->child_mem_sys) !=
NULL)
mem_sys->sibling_mem_sys->ref_mem_sys =
&mem_sys->sibling_mem_sys;
mem_sys->ref_mem_sys = &parent_mem_sys->child_mem_sys;
- /* This is probably not correct as we could have multiple children
- * from a single parent... We probably need a list...
- */
parent_mem_sys->child_mem_sys = mem_sys;
- }
- else {
- mem_sys->ref_mem_sys = NULL;
- mem_sys->sibling_mem_sys = NULL;
}
return APR_SUCCESS;