summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-02-06 22:18:48 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-02-06 22:18:48 +0000
commitfbbafa6d4d20579293b51de798077b9e8c394e94 (patch)
tree369d631b5206ee7c01e9d69016e477286d023e51 /util.c
parent98d84473cbdd600ea0a62255d76863484ac654f0 (diff)
downloadperl-fbbafa6d4d20579293b51de798077b9e8c394e94.tar.gz
Avoid evaluating a strlen twice due the new implementation
of New() with PERL_MALLOC_WRAP p4raw-id: //depot/perl@23943
Diffstat (limited to 'util.c')
-rw-r--r--util.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/util.c b/util.c
index e90d1955ed..fc99463e44 100644
--- a/util.c
+++ b/util.c
@@ -758,10 +758,18 @@ char *
Perl_savepv(pTHX_ const char *pv)
{
register char *newaddr;
+#ifdef PERL_MALLOC_WRAP
+ STRLEN pvlen;
+#endif
if (!pv)
return Nullch;
+#ifdef PERL_MALLOC_WRAP
+ pvlen = strlen(pv)+1;
+ New(902,newaddr,pvlen,char);
+#else
New(902,newaddr,strlen(pv)+1,char);
+#endif
return strcpy(newaddr,pv);
}