summaryrefslogtreecommitdiff
path: root/malloc.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2004-07-16 11:04:37 +0000
committerNicholas Clark <nick@ccl4.org>2004-07-16 11:04:37 +0000
commite90e236463307bd7f53439b91573fe42e9cb8901 (patch)
tree89bf49d9ec83486ed0205849ff8ae782b1c2947e /malloc.c
parentb0bc38e63ed7e7e448fb07e45ee093d3b3d54be8 (diff)
downloadperl-e90e236463307bd7f53439b91573fe42e9cb8901.tar.gz
Encourage compilers to tail call optimise in sv_savepv, sv_savepvn
and sv_savesharedpv. Need to create non-void returning versions of Copy and Zero, as the existing macros deliberately cast to (void) p4raw-id: //depot/perl@23126
Diffstat (limited to 'malloc.c')
-rw-r--r--malloc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/malloc.c b/malloc.c
index 6013e40083..e5f58e4611 100644
--- a/malloc.c
+++ b/malloc.c
@@ -357,6 +357,7 @@
# define Free_t void
# endif
# define Copy(s,d,n,t) (void)memcpy((char*)(d),(char*)(s), (n) * sizeof(t))
+# define CopyD(s,d,n,t) memcpy((char*)(d),(char*)(s), (n) * sizeof(t))
# define PerlEnv_getenv getenv
# define PerlIO_printf fprintf
# define PerlIO_stderr() stderr
@@ -2311,8 +2312,7 @@ Perl_strdup(const char *s)
MEM_SIZE l = strlen(s);
char *s1 = (char *)Perl_malloc(l+1);
- Copy(s, s1, (MEM_SIZE)(l+1), char);
- return s1;
+ return CopyD(s, s1, (MEM_SIZE)(l+1), char);
}
#ifdef PERL_CORE