wrowe 02/01/07 23:03:27
Modified: include apr_rmm.h
misc apr_rmm.c
Log:
Introduce apr_rmm_overhead_get(n) which will calculate the overhead
bytes required for the rmm header and n alloc/calloc block headers.
Revision Changes Path
1.4 +6 -0 apr-util/include/apr_rmm.h
Index: apr_rmm.h
===================================================================
RCS file: /home/cvs/apr-util/include/apr_rmm.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- apr_rmm.h 8 Jan 2002 06:19:15 -0000 1.3
+++ apr_rmm.h 8 Jan 2002 07:03:27 -0000 1.4
@@ -149,6 +149,12 @@
*/
APU_DECLARE(apr_rmm_off_t) apr_rmm_offset_get(apr_rmm_t *rmm, void* entity);
+/**
+ * Compute the required overallocation of memory needed to fit n allocs
+ * @param n The number of alloc/calloc regions desired
+ */
+APU_DECLARE(apr_size_t) apr_rmm_overhead_get(int n);
+
#ifdef __cplusplus
}
#endif
1.4 +5 -0 apr-util/misc/apr_rmm.c
Index: apr_rmm.c
===================================================================
RCS file: /home/cvs/apr-util/misc/apr_rmm.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- apr_rmm.c 8 Jan 2002 06:19:15 -0000 1.3
+++ apr_rmm.c 8 Jan 2002 07:03:27 -0000 1.4
@@ -403,3 +403,8 @@
*/
return ((char*)entity - (char*)rmm->base);
}
+
+APU_DECLARE(apr_size_t) apr_rmm_overhead_get(int n)
+{
+ return sizeof(rmm_hdr_block_t) + n * sizeof(rmm_block_t);
+}