summaryrefslogtreecommitdiff
path: root/gv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2007-01-25 22:39:08 +0000
committerNicholas Clark <nick@ccl4.org>2007-01-25 22:39:08 +0000
commit2ae0db35b275229921515ee6fc05d8e0fca2ef1c (patch)
tree974ca3d57fb6facb381887ece3b349c842e0728d /gv.c
parent06dcd5bfe49c573553f3a05b5b5fdf417bf526a2 (diff)
downloadperl-2ae0db35b275229921515ee6fc05d8e0fca2ef1c.tar.gz
Neither gv_fetchpvn_flags() nor hv_fetch() need a NUL terminated
string, so don't bother allocating buffer space or adding a NUL. p4raw-id: //depot/perl@29983
Diffstat (limited to 'gv.c')
-rw-r--r--gv.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/gv.c b/gv.c
index 9617b82638..39d7a616fb 100644
--- a/gv.c
+++ b/gv.c
@@ -742,14 +742,13 @@ Perl_gv_stashpvn(pTHX_ const char *name, U32 namelen, I32 flags)
HV *stash;
GV *tmpgv;
- if (namelen + 3 < sizeof smallbuf)
+ if (namelen + 2 < sizeof smallbuf)
tmpbuf = smallbuf;
else
- Newx(tmpbuf, namelen + 3, char);
+ Newx(tmpbuf, namelen + 2, char);
Copy(name,tmpbuf,namelen,char);
tmpbuf[namelen++] = ':';
tmpbuf[namelen++] = ':';
- tmpbuf[namelen] = '\0';
tmpgv = gv_fetchpvn_flags(tmpbuf, namelen, flags, SVt_PVHV);
if (tmpbuf != smallbuf)
Safefree(tmpbuf);
@@ -835,14 +834,13 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
char smallbuf[128];
char *tmpbuf;
- if (len + 3 < (I32)sizeof (smallbuf))
+ if (len + 2 < (I32)sizeof (smallbuf))
tmpbuf = smallbuf;
else
- Newx(tmpbuf, len+3, char);
+ Newx(tmpbuf, len+2, char);
Copy(name, tmpbuf, len, char);
tmpbuf[len++] = ':';
tmpbuf[len++] = ':';
- tmpbuf[len] = '\0';
gvp = (GV**)hv_fetch(stash,tmpbuf,len,add);
gv = gvp ? *gvp : NULL;
if (gv && gv != (GV*)&PL_sv_undef) {