summaryrefslogtreecommitdiff
path: root/handy.h
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2002-05-19 00:28:51 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2002-05-19 00:28:51 +0000
commit9965345dfe11415fe4409828505acf6c7fe193b9 (patch)
tree698244d2acf57eb8a374213afbc7d3b728b26182 /handy.h
parent48eb4d6f7d05204aa5e734e924c7236048de530c (diff)
downloadperl-9965345dfe11415fe4409828505acf6c7fe193b9.tar.gz
Sarathy pointed out that instead of zeroing heap
it is more prudent to poison it. p4raw-id: //depot/perl@16688
Diffstat (limited to 'handy.h')
-rw-r--r--handy.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/handy.h b/handy.h
index 2077007b4c..fe29019b43 100644
--- a/handy.h
+++ b/handy.h
@@ -578,8 +578,12 @@ destination, C<nitems> is the number of items, and C<type> is the type.
=for apidoc Am|void|StructCopy|type src|type dest|type
This is an architecture-independent macro to copy one structure to another.
-=cut
-*/
+=for apidoc Am|void|Poison|void* dest|int nitems|type
+
+Fill up memory with a pattern (byte 0xAB over and over again) that
+hopefully catches attempts to access uninitialized memory.
+
+=cut */
#ifndef lint
@@ -623,6 +627,8 @@ extern long lastxycount[MAXXCOUNT][MAXYCOUNT];
#define Copy(s,d,n,t) (void)memcpy((char*)(d),(char*)(s), (n) * sizeof(t))
#define Zero(d,n,t) (void)memzero((char*)(d), (n) * sizeof(t))
+#define Poison(d,n,t) (void)memset((char*)(d), 0xAB, (n) * sizeof(t))
+
#else /* lint */
#define New(x,v,n,s) (v = Null(s *))
@@ -632,6 +638,7 @@ extern long lastxycount[MAXXCOUNT][MAXYCOUNT];
#define Move(s,d,n,t)
#define Copy(s,d,n,t)
#define Zero(d,n,t)
+#define Poison(d,n,t)
#define Safefree(d) (d) = (d)
#endif /* lint */