diff options
author | Andy Lester <andy@petdance.com> | 2005-03-13 08:20:05 -0600 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2005-09-16 19:49:49 +0000 |
commit | 7120cae116be5761a061ba851f494d1cb6acab1d (patch) | |
tree | 6fb40da8442b6989bf5b15705993324eeb85c68c /scope.c | |
parent | 9f8d5c6378d99cc05e8da78d265c5a534017c905 (diff) | |
download | perl-7120cae116be5761a061ba851f494d1cb6acab1d.tar.gz |
Integrate:
[ 24037]
Subject: [PATCH] Adding const qualifiers
Message-ID: <20050313202005.GA23535@petdance.com>
(bowlderised to remove const from all externally linked function
prototypes)
p4raw-link: @24037 on //depot/perl: 35a4481cfdbca4941ab3a4206dc266f3e71c2385
p4raw-id: //depot/maint-5.8/perl@25421
p4raw-edited: from //depot/perl@24037 'edit in' embed.fnc (@24023..)
p4raw-integrated: from //depot/perl@24037 'edit in' scope.c (@23803..)
pp_ctl.c (@24023..) 'merge in' av.c (@23271..) mg.c (@23772..)
gv.c (@23824..) op.c (@23857..) utf8.c (@23861..) hv.c
(@23873..) pod/perlapi.pod (@23913..) proto.h (@24023..)
Diffstat (limited to 'scope.c')
-rw-r--r-- | scope.c | 25 |
1 files changed, 13 insertions, 12 deletions
@@ -140,15 +140,15 @@ Perl_push_scope(pTHX) void Perl_pop_scope(pTHX) { - I32 oldsave = PL_scopestack[--PL_scopestack_ix]; + const I32 oldsave = PL_scopestack[--PL_scopestack_ix]; LEAVE_SCOPE(oldsave); } void Perl_markstack_grow(pTHX) { - I32 oldmax = PL_markstack_max - PL_markstack; - I32 newmax = GROW(oldmax); + const I32 oldmax = PL_markstack_max - PL_markstack; + const I32 newmax = GROW(oldmax); Renew(PL_markstack, newmax, I32); PL_markstack_ptr = PL_markstack + oldmax; @@ -187,7 +187,7 @@ void Perl_free_tmps(pTHX) { /* XXX should tmps_floor live in cxstack? */ - I32 myfloor = PL_tmps_floor; + const I32 myfloor = PL_tmps_floor; while (PL_tmps_ix > myfloor) { /* clean up after last statement */ SV* sv = PL_tmps_stack[PL_tmps_ix]; PL_tmps_stack[PL_tmps_ix--] = Nullsv; @@ -209,7 +209,7 @@ S_save_scalar_at(pTHX_ SV **sptr) sv_upgrade(sv, SvTYPE(osv)); if (SvGMAGICAL(osv)) { MAGIC* mg; - bool oldtainted = PL_tainted; + const bool oldtainted = PL_tainted; mg_get(osv); /* note, can croak! */ if (PL_tainting && PL_tainted && (mg = mg_find(osv, PERL_MAGIC_taint))) { @@ -668,9 +668,9 @@ Perl_save_op(pTHX) I32 Perl_save_alloc(pTHX_ I32 size, I32 pad) { - register I32 start = pad + ((char*)&PL_savestack[PL_savestack_ix] + register const I32 start = pad + ((char*)&PL_savestack[PL_savestack_ix] - (char*)PL_savestack); - register I32 elems = 1 + ((size + pad - 1) / sizeof(*PL_savestack)); + register const I32 elems = 1 + ((size + pad - 1) / sizeof(*PL_savestack)); /* SSCHECK may not be good enough */ while (PL_savestack_ix + elems + 2 > PL_savestack_max) @@ -786,7 +786,7 @@ Perl_leave_scope(pTHX_ I32 base) av = (AV*)SSPOPPTR; gv = (GV*)SSPOPPTR; if (GvAV(gv)) { - AV *goner = GvAV(gv); + AV * const goner = GvAV(gv); SvMAGIC_set(av, SvMAGIC(goner)); SvFLAGS((SV*)av) |= SvMAGICAL(goner); SvMAGICAL_off(goner); @@ -804,7 +804,7 @@ Perl_leave_scope(pTHX_ I32 base) hv = (HV*)SSPOPPTR; gv = (GV*)SSPOPPTR; if (GvHV(gv)) { - HV *goner = GvHV(gv); + HV * const goner = GvHV(gv); SvMAGIC_set(hv, SvMAGIC(goner)); SvFLAGS(hv) |= SvMAGICAL(goner); SvMAGICAL_off(goner); @@ -942,7 +942,8 @@ Perl_leave_scope(pTHX_ I32 base) } } else { /* Someone has a claim on this, so abandon it. */ - U32 padflags = SvFLAGS(sv) & (SVs_PADBUSY|SVs_PADMY|SVs_PADTMP); + const U32 padflags + = SvFLAGS(sv) & (SVs_PADBUSY|SVs_PADMY|SVs_PADTMP); switch (SvTYPE(sv)) { /* Console ourselves with a new value */ case SVt_PVAV: *(SV**)ptr = (SV*)newAV(); break; case SVt_PVHV: *(SV**)ptr = (SV*)newHV(); break; @@ -1001,7 +1002,7 @@ Perl_leave_scope(pTHX_ I32 base) hv = (HV*)SSPOPPTR; ptr = hv_fetch_ent(hv, sv, 1, 0); if (ptr) { - SV *oval = HeVAL((HE*)ptr); + const SV * const oval = HeVAL((HE*)ptr); if (oval && oval != &PL_sv_undef) { ptr = &HeVAL((HE*)ptr); if (SvTIED_mg((SV*)hv, PERL_MAGIC_tied)) @@ -1039,7 +1040,7 @@ Perl_leave_scope(pTHX_ I32 base) break; case SAVEt_PADSV: { - PADOFFSET off = (PADOFFSET)SSPOPLONG; + const PADOFFSET off = (PADOFFSET)SSPOPLONG; ptr = SSPOPPTR; if (ptr) AvARRAY((PAD*)ptr)[off] = (SV*)SSPOPPTR; |