summaryrefslogtreecommitdiff
path: root/pad.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-11-14 21:01:21 +0000
committerNicholas Clark <nick@ccl4.org>2009-11-15 08:21:58 +0000
commit2d12d04f1cca69e8010b11cf63b89ce3b00490b9 (patch)
tree50fcb94429d6af9df0417b0328fe4fc0c2f594de /pad.c
parent73b81b142731b84cfdd5037cbef3bf9cf5ff3094 (diff)
downloadperl-2d12d04f1cca69e8010b11cf63b89ce3b00490b9.tar.gz
Change S_pad_check_dup()'s arguments from char*/STRLEN to SV *.
Within the function, use sv_eq() rather than strcmp().
Diffstat (limited to 'pad.c')
-rw-r--r--pad.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/pad.c b/pad.c
index 3868359598..9245480556 100644
--- a/pad.c
+++ b/pad.c
@@ -397,12 +397,6 @@ Perl_pad_add_name(pTHX_ const char *name, const STRLEN len, const U32 flags,
Perl_croak(aTHX_ "panic: pad_add_name illegal flag bits 0x%" UVxf,
(UV)flags);
-
- if ((flags & pad_add_NO_DUP_CHECK) == 0) {
- /* check for duplicate declaration */
- pad_check_dup(name, len, flags & pad_add_OUR, ourstash);
- }
-
namesv = newSV_type((ourstash || typestash) ? SVt_PVMG : SVt_PVNV);
/* Until we're using the length for real, cross check that we're being told
@@ -412,6 +406,11 @@ Perl_pad_add_name(pTHX_ const char *name, const STRLEN len, const U32 flags,
sv_setpv(namesv, name);
+ if ((flags & pad_add_NO_DUP_CHECK) == 0) {
+ /* check for duplicate declaration */
+ pad_check_dup(namesv, flags & pad_add_OUR, ourstash);
+ }
+
offset = pad_add_name_sv(namesv, flags, typestash, ourstash);
/* not yet introduced */
@@ -562,8 +561,7 @@ C<is_our> indicates that the name to check is an 'our' declaration
*/
void
-S_pad_check_dup(pTHX_ const char *name, const STRLEN len, const U32 flags,
- const HV *ourstash)
+S_pad_check_dup(pTHX_ SV *name, const U32 flags, const HV *ourstash)
{
dVAR;
SV **svp;
@@ -576,11 +574,6 @@ S_pad_check_dup(pTHX_ const char *name, const STRLEN len, const U32 flags,
assert((flags & ~pad_add_OUR) == 0);
- /* Until we're using the length for real, cross check that we're being told
- the truth. */
- PERL_UNUSED_ARG(len);
- assert(strlen(name) == len);
-
if (AvFILLp(PL_comppad_name) < 0 || !ckWARN(WARN_MISC))
return; /* nothing to check */
@@ -595,7 +588,7 @@ S_pad_check_dup(pTHX_ const char *name, const STRLEN len, const U32 flags,
&& sv != &PL_sv_undef
&& !SvFAKE(sv)
&& (COP_SEQ_RANGE_HIGH(sv) == PAD_MAX || COP_SEQ_RANGE_HIGH(sv) == 0)
- && strEQ(name, SvPVX_const(sv)))
+ && sv_eq(name, sv))
{
if (is_our && (SvPAD_OUR(sv)))
break; /* "our" masking "our" */
@@ -617,7 +610,7 @@ S_pad_check_dup(pTHX_ const char *name, const STRLEN len, const U32 flags,
&& !SvFAKE(sv)
&& (COP_SEQ_RANGE_HIGH(sv) == PAD_MAX || COP_SEQ_RANGE_HIGH(sv) == 0)
&& SvOURSTASH(sv) == ourstash
- && strEQ(name, SvPVX_const(sv)))
+ && sv_eq(name, sv))
{
Perl_warner(aTHX_ packWARN(WARN_MISC),
"\"our\" variable %"SVf" redeclared", sv);