dougm 02/03/14 15:18:56
Modified: . CHANGES
include apr_rmm.h
misc apr_rmm.c
Log:
Submitted by: Madhusudan Mathihalli <[EMAIL PROTECTED]>
Reviewed by: dougm
add apr_rmm_realloc() function
Revision Changes Path
1.59 +3 -0 apr-util/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apr-util/CHANGES,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- CHANGES 6 Mar 2002 17:51:22 -0000 1.58
+++ CHANGES 14 Mar 2002 23:18:56 -0000 1.59
@@ -1,5 +1,8 @@
Changes with APR-util b1
+ *) add apr_rmm_realloc() function
+ [Madhusudan Mathihalli <[EMAIL PROTECTED]>]
+
*) renames: apr_ansi_time_to_apr_time becomes apr_time_ansi_put
ap_exploded_time_t becomes apr_time_exp_t
[Thom May <[EMAIL PROTECTED]>]
1.6 +1 -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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- apr_rmm.h 13 Mar 2002 20:40:48 -0000 1.5
+++ apr_rmm.h 14 Mar 2002 23:18:56 -0000 1.6
@@ -120,6 +120,7 @@
* @param reqsize How much memory to allocate
*/
APU_DECLARE(apr_rmm_off_t) apr_rmm_malloc(apr_rmm_t *rmm, apr_size_t
reqsize);
+APU_DECLARE(apr_rmm_off_t) apr_rmm_realloc(apr_rmm_t *rmm, void *entity,
apr_size_t reqsize);
/**
* Allocate memory from the block of relocatable memory and initialize it to
zero.
1.9 +27 -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.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- apr_rmm.c 13 Mar 2002 20:40:49 -0000 1.8
+++ apr_rmm.c 14 Mar 2002 23:18:56 -0000 1.9
@@ -368,6 +368,33 @@
return this;
}
+APU_DECLARE(apr_rmm_off_t) apr_rmm_realloc(apr_rmm_t *rmm, void *entity,
+ apr_size_t reqsize)
+{
+ apr_status_t rv;
+ apr_rmm_off_t this;
+ apr_rmm_off_t old;
+
+ if (!entity) {
+ return apr_rmm_malloc(rmm, reqsize);
+ }
+
+ reqsize = (1 + (reqsize - 1) / grain) * grain;
+ old = apr_rmm_offset_get(rmm, entity);
+
+ if ((this = apr_rmm_malloc(rmm, reqsize)) < 0) {
+ return rv;
+ }
+
+ if (old >= 0) {
+ memcpy(apr_rmm_addr_get(rmm, this),
+ apr_rmm_addr_get(rmm, old),reqsize);
+ move_block(rmm, old, 1);
+ }
+
+ return this;
+}
+
APU_DECLARE(apr_status_t) apr_rmm_free(apr_rmm_t *rmm, apr_rmm_off_t this)
{
apr_status_t rv;