Resort MANIFEST - Latest Module::Build MANIFEST update broke sorting.
[p5sagit/p5-mst-13.2.git] / pad.c
diff --git a/pad.c b/pad.c
index 3868359..fdf4402 100644 (file)
--- a/pad.c
+++ b/pad.c
@@ -360,7 +360,7 @@ S_pad_add_name_sv(pTHX_ SV *namesv, const U32 flags, HV *typestash,
        SvOURSTASH_set(namesv, ourstash);
        SvREFCNT_inc_simple_void_NN(ourstash);
     }
-    else if (flags & pad_add_STATE) {
+    else if (flags & padadd_STATE) {
        SvPAD_STATE_on(namesv);
     }
 
@@ -393,16 +393,10 @@ Perl_pad_add_name(pTHX_ const char *name, const STRLEN len, const U32 flags,
 
     PERL_ARGS_ASSERT_PAD_ADD_NAME;
 
-    if (flags & ~(pad_add_OUR|pad_add_STATE|pad_add_NO_DUP_CHECK))
+    if (flags & ~(padadd_OUR|padadd_STATE|padadd_NO_DUP_CHECK))
        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 & padadd_NO_DUP_CHECK) == 0) {
+       /* check for duplicate declaration */
+       pad_check_dup(namesv, flags & padadd_OUR, ourstash);
+    }
+
     offset = pad_add_name_sv(namesv, flags, typestash, ourstash);
 
     /* not yet introduced */
@@ -561,25 +560,19 @@ C<is_our> indicates that the name to check is an 'our' declaration
 =cut
 */
 
-void
-S_pad_check_dup(pTHX_ const char *name, const STRLEN len, const U32 flags,
-                  const HV *ourstash)
+STATIC void
+S_pad_check_dup(pTHX_ SV *name, const U32 flags, const HV *ourstash)
 {
     dVAR;
     SV         **svp;
     PADOFFSET  top, off;
-    const U32  is_our = flags & pad_add_OUR;
+    const U32  is_our = flags & padadd_OUR;
 
     PERL_ARGS_ASSERT_PAD_CHECK_DUP;
 
     ASSERT_CURPAD_ACTIVE("pad_check_dup");
 
-    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);
+    assert((flags & ~padadd_OUR) == 0);
 
     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);
@@ -926,7 +919,7 @@ S_pad_findlex(pTHX_ const char *name, const CV* cv, U32 seq, int warn,
 
        new_offset
            = pad_add_name_sv(new_namesv,
-                             (SvPAD_STATE(*out_name_sv) ? pad_add_STATE : 0),
+                             (SvPAD_STATE(*out_name_sv) ? padadd_STATE : 0),
                              SvPAD_TYPED(*out_name_sv)
                              ? SvSTASH(*out_name_sv) : NULL,
                              SvOURSTASH(*out_name_sv)