summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorAndy Lester <andy@petdance.com>2005-07-03 13:31:56 -0500
committerSteve Hay <SteveHay@planit.com>2005-07-04 12:30:50 +0000
commitb64e5050699224c037d91354e38766884caa0910 (patch)
tree38f329ba2a365c8eec6078887704f6e2c59562c6 /sv.c
parentc941fb51a763b50ea8ceb343cf253ac80c4ca160 (diff)
downloadperl-b64e5050699224c037d91354e38766884caa0910.tar.gz
Post-YAPC consting, now with an attachment!
Message-ID: <20050703233156.GA20967@petdance.com> p4raw-id: //depot/perl@25067
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/sv.c b/sv.c
index 0bf15d3ef6..0dfe6a2e0c 100644
--- a/sv.c
+++ b/sv.c
@@ -3661,7 +3661,7 @@ Perl_sv_utf8_decode(pTHX_ register SV *sv)
return FALSE;
e = (const U8 *) SvEND(sv);
while (c < e) {
- U8 ch = *c++;
+ const U8 ch = *c++;
if (!UTF8_IS_INVARIANT(ch)) {
SvUTF8_on(sv);
break;
@@ -4555,7 +4555,7 @@ Perl_sv_force_normal_flags(pTHX_ register SV *sv, U32 flags)
if (SvREADONLY(sv)) {
/* At this point I believe I should acquire a global SV mutex. */
if (SvFAKE(sv)) {
- const char *pvx = SvPVX_const(sv);
+ const char * const pvx = SvPVX_const(sv);
const STRLEN len = SvLEN(sv);
const STRLEN cur = SvCUR(sv);
SV * const next = SV_COW_NEXT_SV(sv); /* next COW sv in the loop. */
@@ -4591,7 +4591,7 @@ Perl_sv_force_normal_flags(pTHX_ register SV *sv, U32 flags)
#else
if (SvREADONLY(sv)) {
if (SvFAKE(sv)) {
- const char *pvx = SvPVX_const(sv);
+ const char * const pvx = SvPVX_const(sv);
const STRLEN len = SvCUR(sv);
SvFAKE_off(sv);
SvREADONLY_off(sv);
@@ -7266,8 +7266,8 @@ Perl_newSVhek(pTHX_ const HEK *hek)
Andreas would like keys he put in as utf8 to come back as utf8
*/
STRLEN utf8_len = HEK_LEN(hek);
- U8 *as_utf8 = bytes_to_utf8 ((U8*)HEK_KEY(hek), &utf8_len);
- SV *sv = newSVpvn ((char*)as_utf8, utf8_len);
+ const U8 *as_utf8 = bytes_to_utf8 ((U8*)HEK_KEY(hek), &utf8_len);
+ SV * const sv = newSVpvn ((const char*)as_utf8, utf8_len);
SvUTF8_on (sv);
Safefree (as_utf8); /* bytes_to_utf8() allocates a new string */
@@ -7279,7 +7279,7 @@ Perl_newSVhek(pTHX_ const HEK *hek)
that would contain the (wrong) hash value, and might get passed
into an hv routine with a regular hash */
- SV *sv = newSVpvn (HEK_KEY(hek), HEK_LEN(hek));
+ SV * const sv = newSVpvn (HEK_KEY(hek), HEK_LEN(hek));
if (HEK_UTF8(hek))
SvUTF8_on (sv);
return sv;
@@ -7910,19 +7910,17 @@ Perl_sv_pvn_force_flags(pTHX_ SV *sv, STRLEN *lp, I32 flags)
STRLEN len;
if (SvREADONLY(sv) && !(flags & SV_MUTABLE_RETURN)) {
+ const char * const ref = sv_reftype(sv,0);
if (PL_op)
Perl_croak(aTHX_ "Can't coerce readonly %s to string in %s",
- sv_reftype(sv,0), OP_NAME(PL_op));
+ ref, OP_NAME(PL_op));
else
- Perl_croak(aTHX_ "Can't coerce readonly %s to string",
- sv_reftype(sv,0));
+ Perl_croak(aTHX_ "Can't coerce readonly %s to string", ref);
}
- if (SvTYPE(sv) > SVt_PVLV && SvTYPE(sv) != SVt_PVFM) {
+ if (SvTYPE(sv) > SVt_PVLV && SvTYPE(sv) != SVt_PVFM)
Perl_croak(aTHX_ "Can't coerce %s to string in %s", sv_reftype(sv,0),
OP_NAME(PL_op));
- }
- else
- s = sv_2pv_flags(sv, &len, flags);
+ s = sv_2pv_flags(sv, &len, flags);
if (lp)
*lp = len;
@@ -8403,7 +8401,7 @@ See C<SvROK_off>.
void
Perl_sv_unref_flags(pTHX_ SV *ref, U32 flags)
{
- SV* target = SvRV(ref);
+ SV* const target = SvRV(ref);
if (SvWEAKREF(ref)) {
sv_del_backref(target, ref);
@@ -8462,7 +8460,7 @@ void
Perl_sv_untaint(pTHX_ SV *sv)
{
if (SvTYPE(sv) >= SVt_PVMG && SvMAGIC(sv)) {
- MAGIC *mg = mg_find(sv, PERL_MAGIC_taint);
+ MAGIC * const mg = mg_find(sv, PERL_MAGIC_taint);
if (mg)
mg->mg_len &= ~1;
}
@@ -8500,7 +8498,7 @@ Perl_sv_setpviv(pTHX_ SV *sv, IV iv)
{
char buf[TYPE_CHARS(UV)];
char *ebuf;
- char *ptr = uiv_2buf(buf, iv, 0, 0, &ebuf);
+ char * const ptr = uiv_2buf(buf, iv, 0, 0, &ebuf);
sv_setpvn(sv, ptr, ebuf - ptr);
}
@@ -8518,7 +8516,7 @@ Perl_sv_setpviv_mg(pTHX_ SV *sv, IV iv)
{
char buf[TYPE_CHARS(UV)];
char *ebuf;
- char *ptr = uiv_2buf(buf, iv, 0, 0, &ebuf);
+ char * const ptr = uiv_2buf(buf, iv, 0, 0, &ebuf);
sv_setpvn(sv, ptr, ebuf - ptr);
SvSETMAGIC(sv);