summaryrefslogtreecommitdiff
path: root/pad.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-11-14 20:18:39 +0000
committerNicholas Clark <nick@ccl4.org>2009-11-15 08:21:57 +0000
commit73b81b142731b84cfdd5037cbef3bf9cf5ff3094 (patch)
treed19e78c79f73d4698d5e7a4b01338ed2f4441f59 /pad.c
parent3291825f3fd927adacdb9c44790978a741046199 (diff)
downloadperl-73b81b142731b84cfdd5037cbef3bf9cf5ff3094.tar.gz
Convert pad_check_dup() to static linkage, and call it from Perl_pad_add_name().
Provide a flag option to Perl_pad_add_name(), pad_add_NO_DUP_CHECK, to supress the call.
Diffstat (limited to 'pad.c')
-rw-r--r--pad.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/pad.c b/pad.c
index 4280c9f519..3868359598 100644
--- a/pad.c
+++ b/pad.c
@@ -393,10 +393,16 @@ Perl_pad_add_name(pTHX_ const char *name, const STRLEN len, const U32 flags,
PERL_ARGS_ASSERT_PAD_ADD_NAME;
- if (flags & ~(pad_add_STATE))
+ if (flags & ~(pad_add_OUR|pad_add_STATE|pad_add_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
@@ -555,10 +561,8 @@ C<is_our> indicates that the name to check is an 'our' declaration
=cut
*/
-/* XXX DAPM integrate this into pad_add_name ??? */
-
void
-Perl_pad_check_dup(pTHX_ const char *name, const STRLEN len, const U32 flags,
+S_pad_check_dup(pTHX_ const char *name, const STRLEN len, const U32 flags,
const HV *ourstash)
{
dVAR;
@@ -570,9 +574,7 @@ Perl_pad_check_dup(pTHX_ const char *name, const STRLEN len, const U32 flags,
ASSERT_CURPAD_ACTIVE("pad_check_dup");
- if (flags & ~pad_add_OUR)
- Perl_croak(aTHX_ "panic: pad_check_dup illegal flag bits 0x%" UVxf,
- (UV)flags);
+ assert((flags & ~pad_add_OUR) == 0);
/* Until we're using the length for real, cross check that we're being told
the truth. */