summaryrefslogtreecommitdiff
path: root/pad.c
diff options
context:
space:
mode:
authorAndy Lester <andy@petdance.com>2005-06-20 05:22:37 -0500
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-06-20 15:12:50 +0000
commit53c1dcc098c6cc47963786f1928061d90b5d30e1 (patch)
tree018888fffdf323f44128fe1434e39e7b5cccceae /pad.c
parent7e3ec654269fdea39968d4cec52cbfcb1f030631 (diff)
downloadperl-53c1dcc098c6cc47963786f1928061d90b5d30e1.tar.gz
The continuing adventures of Constman and Localize Boy
Message-ID: <20050620152237.GA5032@petdance.com> p4raw-id: //depot/perl@24913
Diffstat (limited to 'pad.c')
-rw-r--r--pad.c71
1 files changed, 35 insertions, 36 deletions
diff --git a/pad.c b/pad.c
index e821069a8b..9c2b5a2410 100644
--- a/pad.c
+++ b/pad.c
@@ -248,12 +248,12 @@ Perl_pad_undef(pTHX_ CV* cv)
* children, or integrate this loop with general cleanup */
if (!PL_dirty) { /* don't bother during global destruction */
- CV *outercv = CvOUTSIDE(cv);
+ CV * const outercv = CvOUTSIDE(cv);
const U32 seq = CvOUTSIDE_SEQ(cv);
- AV *comppad_name = (AV*)AvARRAY(padlist)[0];
- SV **namepad = AvARRAY(comppad_name);
- AV *comppad = (AV*)AvARRAY(padlist)[1];
- SV **curpad = AvARRAY(comppad);
+ AV * const comppad_name = (AV*)AvARRAY(padlist)[0];
+ SV ** const namepad = AvARRAY(comppad_name);
+ AV * const comppad = (AV*)AvARRAY(padlist)[1];
+ SV ** const curpad = AvARRAY(comppad);
for (ix = AvFILLp(comppad_name); ix > 0; ix--) {
SV * const namesv = namepad[ix];
if (namesv && namesv != &PL_sv_undef
@@ -293,7 +293,7 @@ Perl_pad_undef(pTHX_ CV* cv)
ix = AvFILLp(padlist);
while (ix >= 0) {
- SV* sv = AvARRAY(padlist)[ix--];
+ SV* const sv = AvARRAY(padlist)[ix--];
if (!sv)
continue;
if (sv == (SV*)PL_comppad_name)
@@ -330,7 +330,7 @@ PADOFFSET
Perl_pad_add_name(pTHX_ const char *name, HV* typestash, HV* ourstash, bool fake)
{
const PADOFFSET offset = pad_alloc(OP_PADSV, SVs_PADMY);
- SV* namesv = NEWSV(1102, 0);
+ SV* const namesv = NEWSV(1102, 0);
ASSERT_CURPAD_ACTIVE("pad_add_name");
@@ -411,7 +411,7 @@ Perl_pad_alloc(pTHX_ I32 optype, U32 tmptype)
retval = AvFILLp(PL_comppad);
}
else {
- SV **names = AvARRAY(PL_comppad_name);
+ SV ** const names = AvARRAY(PL_comppad_name);
const SSize_t names_fill = AvFILLp(PL_comppad_name);
for (;;) {
/*
@@ -498,7 +498,7 @@ C<is_our> indicates that the name to check is an 'our' declaration
void
Perl_pad_check_dup(pTHX_ const char *name, bool is_our, const HV *ourstash)
{
- SV **svp, *sv;
+ SV **svp;
PADOFFSET top, off;
ASSERT_CURPAD_ACTIVE("pad_check_dup");
@@ -511,7 +511,8 @@ Perl_pad_check_dup(pTHX_ const char *name, bool is_our, const HV *ourstash)
/* XXX DAPM - why the (I32) cast - shouldn't we ensure they're the same
* type ? */
for (off = top; (I32)off > PL_comppad_name_floor; off--) {
- if ((sv = svp[off])
+ SV * const sv = svp[off];
+ if (sv
&& sv != &PL_sv_undef
&& !SvFAKE(sv)
&& (SvIVX(sv) == PAD_MAX || SvIVX(sv) == 0)
@@ -531,7 +532,8 @@ Perl_pad_check_dup(pTHX_ const char *name, bool is_our, const HV *ourstash)
/* check the rest of the pad */
if (is_our) {
do {
- if ((sv = svp[off])
+ SV * const sv = svp[off];
+ if (sv
&& sv != &PL_sv_undef
&& !SvFAKE(sv)
&& (SvIVX(sv) == PAD_MAX || SvIVX(sv) == 0)
@@ -809,8 +811,8 @@ S_pad_findlex(pTHX_ const char *name, const CV* cv, U32 seq, int warn,
{
SV *new_namesv;
- AV *ocomppad_name = PL_comppad_name;
- PAD *ocomppad = PL_comppad;
+ AV * const ocomppad_name = PL_comppad_name;
+ PAD * const ocomppad = PL_comppad;
PL_comppad_name = (AV*)AvARRAY(padlist)[0];
PL_comppad = (AV*)AvARRAY(padlist)[1];
PL_curpad = AvARRAY(PL_comppad);
@@ -950,7 +952,6 @@ U32
Perl_intro_my(pTHX)
{
SV **svp;
- SV *sv;
I32 i;
ASSERT_CURPAD_ACTIVE("intro_my");
@@ -959,9 +960,9 @@ Perl_intro_my(pTHX)
svp = AvARRAY(PL_comppad_name);
for (i = PL_min_intro_pending; i <= PL_max_intro_pending; i++) {
- if ((sv = svp[i]) && sv != &PL_sv_undef
- && !SvFAKE(sv) && !SvIVX(sv))
- {
+ SV * const sv = svp[i];
+
+ if (sv && sv != &PL_sv_undef && !SvFAKE(sv) && !SvIVX(sv)) {
SvIV_set(sv, PAD_MAX); /* Don't know scope end yet. */
SvNV_set(sv, (NV)PL_cop_seqmax);
DEBUG_Xv(PerlIO_printf(Perl_debug_log,
@@ -992,15 +993,15 @@ void
Perl_pad_leavemy(pTHX)
{
I32 off;
- SV **svp = AvARRAY(PL_comppad_name);
+ SV ** const svp = AvARRAY(PL_comppad_name);
PL_pad_reset_pending = FALSE;
ASSERT_CURPAD_ACTIVE("pad_leavemy");
if (PL_min_intro_pending && PL_comppad_name_fill < PL_min_intro_pending) {
for (off = PL_max_intro_pending; off >= PL_min_intro_pending; off--) {
- const SV *sv;
- if ((sv = svp[off]) && sv != &PL_sv_undef
+ const SV * const sv = svp[off];
+ if (sv && sv != &PL_sv_undef
&& !SvFAKE(sv) && ckWARN_d(WARN_INTERNAL))
Perl_warner(aTHX_ packWARN(WARN_INTERNAL),
"%"SVf" never introduced", sv);
@@ -1008,10 +1009,8 @@ Perl_pad_leavemy(pTHX)
}
/* "Deintroduce" my variables that are leaving with this scope. */
for (off = AvFILLp(PL_comppad_name); off > PL_comppad_name_fill; off--) {
- const SV *sv;
- if ((sv = svp[off]) && sv != &PL_sv_undef
- && !SvFAKE(sv) && SvIVX(sv) == PAD_MAX)
- {
+ const SV * const sv = svp[off];
+ if (sv && sv != &PL_sv_undef && !SvFAKE(sv) && SvIVX(sv) == PAD_MAX) {
SvIV_set(sv, PL_cop_seqmax);
DEBUG_Xv(PerlIO_printf(Perl_debug_log,
"Pad leavemy: %ld \"%s\", (%ld,%ld)\n",
@@ -1153,7 +1152,7 @@ Perl_pad_tidy(pTHX_ padtidy_type type)
av_store(PL_comppad_name, AvFILLp(PL_comppad), Nullsv);
if (type == padtidy_SUBCLONE) {
- SV **namep = AvARRAY(PL_comppad_name);
+ SV ** const namep = AvARRAY(PL_comppad_name);
PADOFFSET ix;
for (ix = AvFILLp(PL_comppad); ix > 0; ix--) {
@@ -1177,7 +1176,7 @@ Perl_pad_tidy(pTHX_ padtidy_type type)
}
else if (type == padtidy_SUB) {
/* XXX DAPM this same bit of code keeps appearing !!! Rationalise? */
- AV *av = newAV(); /* Will be @_ */
+ AV * const av = newAV(); /* Will be @_ */
av_extend(av, 0);
av_store(PL_comppad, 0, (SV*)av);
AvREIFY_only(av);
@@ -1332,8 +1331,8 @@ dump the contents of a CV
STATIC void
S_cv_dump(pTHX_ const CV *cv, const char *title)
{
- const CV *outside = CvOUTSIDE(cv);
- AV* padlist = CvPADLIST(cv);
+ const CV * const outside = CvOUTSIDE(cv);
+ AV* const padlist = CvPADLIST(cv);
PerlIO_printf(Perl_debug_log,
" %s: CV=0x%"UVxf" (%s), OUTSIDE=0x%"UVxf" (%s)\n",
@@ -1376,11 +1375,11 @@ Perl_cv_clone(pTHX_ CV *proto)
{
dVAR;
I32 ix;
- AV* protopadlist = CvPADLIST(proto);
- const AV* protopad_name = (AV*)*av_fetch(protopadlist, 0, FALSE);
- const AV* protopad = (AV*)*av_fetch(protopadlist, 1, FALSE);
- SV** pname = AvARRAY(protopad_name);
- SV** ppad = AvARRAY(protopad);
+ AV* const protopadlist = CvPADLIST(proto);
+ const AV* const protopad_name = (AV*)*av_fetch(protopadlist, 0, FALSE);
+ const AV* const protopad = (AV*)*av_fetch(protopadlist, 1, FALSE);
+ SV** const pname = AvARRAY(protopad_name);
+ SV** const ppad = AvARRAY(protopad);
const I32 fname = AvFILLp(protopad_name);
const I32 fpad = AvFILLp(protopad);
CV* cv;
@@ -1440,7 +1439,7 @@ Perl_cv_clone(pTHX_ CV *proto)
outpad = AvARRAY(AvARRAY(CvPADLIST(outside))[depth]);
for (ix = fpad; ix > 0; ix--) {
- SV* namesv = (ix <= fname) ? pname[ix] : Nullsv;
+ SV* const namesv = (ix <= fname) ? pname[ix] : Nullsv;
SV *sv = Nullsv;
if (namesv && namesv != &PL_sv_undef) { /* lexical */
if (SvFAKE(namesv)) { /* lexical from outside? */
@@ -1526,8 +1525,8 @@ Perl_pad_fixup_inner_anons(pTHX_ PADLIST *padlist, CV *old_cv, CV *new_cv)
I32 ix;
AV * const comppad_name = (AV*)AvARRAY(padlist)[0];
AV * const comppad = (AV*)AvARRAY(padlist)[1];
- SV **namepad = AvARRAY(comppad_name);
- SV **curpad = AvARRAY(comppad);
+ SV ** const namepad = AvARRAY(comppad_name);
+ SV ** const curpad = AvARRAY(comppad);
for (ix = AvFILLp(comppad_name); ix > 0; ix--) {
const SV *namesv = namepad[ix];
if (namesv && namesv != &PL_sv_undef