summaryrefslogtreecommitdiff
path: root/utf8.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-06-10 23:12:29 +0000
committerNicholas Clark <nick@ccl4.org>2005-06-10 23:12:29 +0000
commitcfd0369c40b647df9444518ec26b924a57e14ac8 (patch)
tree688266bb3bff13d1164c071a95ed34e1cd649038 /utf8.c
parent349d4f2f3d114fbec6897c6007862eb07a409a2d (diff)
downloadperl-cfd0369c40b647df9444518ec26b924a57e14ac8.tar.gz
More SvPV consting. And other related drive-by refactoring.
p4raw-id: //depot/perl@24800
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/utf8.c b/utf8.c
index 625d3b656c..b26d5a63f2 100644
--- a/utf8.c
+++ b/utf8.c
@@ -1476,9 +1476,9 @@ Perl_to_utf8_case(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, SV **swashp, const
if ((hv = get_hv(special, FALSE)) &&
(svp = hv_fetch(hv, (const char*)tmpbuf, UNISKIP(uv1), FALSE)) &&
(*svp)) {
- char *s;
+ const char *s;
- s = SvPV(*svp, len);
+ s = SvPV_const(*svp, len);
if (len == 1)
len = uvuni_to_utf8(ustrp, NATIVE_TO_UNI(*(U8*)s)) - ustrp;
else {
@@ -1674,7 +1674,7 @@ Perl_swash_init(pTHX_ const char* pkg, const char* name, SV *listsv, I32 minbits
POPSTACK;
if (IN_PERL_COMPILETIME) {
STRLEN len;
- const char* pv = SvPV(tokenbufsv, len);
+ const char* pv = SvPV_const(tokenbufsv, len);
Copy(pv, PL_tokenbuf, len+1, char);
PL_curcop->op_private = (U8)(PL_hints & HINT_PRIVATE_MASK);
@@ -1703,7 +1703,7 @@ Perl_swash_fetch(pTHX_ SV *sv, const U8 *ptr, bool do_utf8)
U32 off;
STRLEN slen;
STRLEN needents;
- U8 *tmps = NULL;
+ const U8 *tmps = NULL;
U32 bit;
SV *retval;
U8 tmputf8[2];
@@ -1758,7 +1758,7 @@ Perl_swash_fetch(pTHX_ SV *sv, const U8 *ptr, bool do_utf8)
SV** svp = hv_fetch(hv, (const char*)ptr, klen, FALSE);
/* If not cached, generate it via utf8::SWASHGET */
- if (!svp || !SvPOK(*svp) || !(tmps = (U8*)SvPV(*svp, slen))) {
+ if (!svp || !SvPOK(*svp) || !(tmps = (const U8*)SvPV_const(*svp, slen))) {
dSP;
/* We use utf8n_to_uvuni() as we want an index into
Unicode tables, not a native character number.
@@ -1801,7 +1801,8 @@ Perl_swash_fetch(pTHX_ SV *sv, const U8 *ptr, bool do_utf8)
PL_last_swash_hv = hv;
PL_last_swash_klen = klen;
- PL_last_swash_tmps = tmps;
+ /* FIXME change interpvar.h? */
+ PL_last_swash_tmps = (U8 *) tmps;
PL_last_swash_slen = slen;
if (klen)
Copy(ptr, PL_last_swash_key, klen, U8);
@@ -1969,8 +1970,8 @@ The pointer to the PV of the dsv is returned.
char *
Perl_sv_uni_display(pTHX_ SV *dsv, SV *ssv, STRLEN pvlim, UV flags)
{
- return Perl_pv_uni_display(aTHX_ dsv, (U8*)SvPVX(ssv), SvCUR(ssv),
- pvlim, flags);
+ return Perl_pv_uni_display(aTHX_ dsv, (const U8*)SvPVX_const(ssv),
+ SvCUR(ssv), pvlim, flags);
}
/*