summaryrefslogtreecommitdiff
path: root/handy.h
diff options
context:
space:
mode:
authorJim Cromie <jcromie@cpan.org>2005-07-06 08:19:53 -0600
committerSteve Hay <SteveHay@planit.com>2005-07-08 16:35:10 +0000
commita02a5408b2f199007c4dcb74559cc79066307ada (patch)
treeb5456b7513dec78b81e08371fbd59138e2edfe72 /handy.h
parentbdf3085f9fca00a6148ef3f26060d442844b64bd (diff)
downloadperl-a02a5408b2f199007c4dcb74559cc79066307ada.tar.gz
Re: janitorial work ? [patch]
Message-ID: <42CC3CE9.5050606@divsol.com> (reverted all dual-lived modules since they must work with older perls too so must wait for a new Devel::PPPort) p4raw-id: //depot/perl@25101
Diffstat (limited to 'handy.h')
-rw-r--r--handy.h22
1 files changed, 16 insertions, 6 deletions
diff --git a/handy.h b/handy.h
index 228490f5b7..d0366c3e3c 100644
--- a/handy.h
+++ b/handy.h
@@ -534,17 +534,22 @@ C<id> is an integer id between 0 and 1299 (used to identify leaks).
=head1 Memory Management
-=for apidoc Am|void|New|int id|void* ptr|int nitems|type
+=for apidoc Am|void|Newx|void* ptr|int nitems|type
The XSUB-writer's interface to the C C<malloc> function.
-=for apidoc Am|void|Newc|int id|void* ptr|int nitems|type|cast
+=for apidoc Am|void|Newxc|void* ptr|int nitems|type|cast
The XSUB-writer's interface to the C C<malloc> function, with
cast.
-=for apidoc Am|void|Newz|int id|void* ptr|int nitems|type
+=for apidoc Am|void|Newxz|void* ptr|int nitems|type
The XSUB-writer's interface to the C C<malloc> function. The allocated
memory is zeroed with C<memzero>.
+In 5.9.3, we removed the 1st parameter, a debug aid, from the api. It
+was used to uniquely identify each usage of these allocation
+functions, but was deemed unnecessary with the availability of better
+memory tracking tools, valgrind for example.
+
=for apidoc Am|void|Renew|void* ptr|int nitems|type
The XSUB-writer's interface to the C C<realloc> function.
@@ -618,10 +623,15 @@ hopefully catches attempts to access uninitialized memory.
#endif
-#define New(x,v,n,t) (v = (MEM_WRAP_CHECK_(n,t) (t*)safemalloc((MEM_SIZE)((n)*sizeof(t)))))
-#define Newc(x,v,n,t,c) (v = (MEM_WRAP_CHECK_(n,t) (c*)safemalloc((MEM_SIZE)((n)*sizeof(t)))))
-#define Newz(x,v,n,t) (v = (MEM_WRAP_CHECK_(n,t) (t*)safemalloc((MEM_SIZE)((n)*sizeof(t))))), \
+#define Newx(v,n,t) (v = (MEM_WRAP_CHECK_(n,t) (t*)safemalloc((MEM_SIZE)((n)*sizeof(t)))))
+#define Newxc(v,n,t,c) (v = (MEM_WRAP_CHECK_(n,t) (c*)safemalloc((MEM_SIZE)((n)*sizeof(t)))))
+#define Newxz(v,n,t) (v = (MEM_WRAP_CHECK_(n,t) (t*)safemalloc((MEM_SIZE)((n)*sizeof(t))))), \
memzero((char*)(v), (n)*sizeof(t))
+/* pre 5.9.x compatibility */
+#define New(x,v,n,t) Newx(v,n,t)
+#define Newc(x,v,n,t,c) Newxc(v,n,t,c)
+#define Newc(x,v,n,t,c) Newxc(v,n,t,c)
+
#define Renew(v,n,t) \
(v = (MEM_WRAP_CHECK_(n,t) (t*)saferealloc((Malloc_t)(v),(MEM_SIZE)((n)*sizeof(t)))))
#define Renewc(v,n,t,c) \