summaryrefslogtreecommitdiff
path: root/perl.h
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-06-01 20:46:02 +0000
committerNicholas Clark <nick@ccl4.org>2005-06-01 20:46:02 +0000
commite5fc398ae0b5fa5d4f2b3f5d35e964bf6aadd1b6 (patch)
tree09a500b0d6951b724685d60716d06c2d8ac13770 /perl.h
parent1019c5e2e77274f1569b932c7015971b13542ed3 (diff)
downloadperl-e5fc398ae0b5fa5d4f2b3f5d35e964bf6aadd1b6.tar.gz
Round up all string length requests to malloc()/realloc() to the next
multiple of 4/8 bytes [sizeof(size_t)] on the assumption that malloc() internally will quantise, and so we're going to use space that otherwise would be wasted. Hopefully this will save realloc()ing. p4raw-id: //depot/perl@24665
Diffstat (limited to 'perl.h')
-rw-r--r--perl.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/perl.h b/perl.h
index bfa632f5a4..aedc918923 100644
--- a/perl.h
+++ b/perl.h
@@ -803,6 +803,13 @@ int usleep(unsigned int);
#define MEM_SIZE Size_t
+/* Round all values passed to malloc up, by default to a multiple of
+ sizeof(size_t)
+*/
+#ifndef PERL_STRLEN_ROUNDUP_QUANTUM
+#define PERL_STRLEN_ROUNDUP_QUANTUM Size_t_size
+#endif
+
#if defined(STANDARD_C) && defined(I_STDDEF)
# include <stddef.h>
# define STRUCT_OFFSET(s,m) offsetof(s,m)