From: Andy Lester Date: Mon, 14 Mar 2005 13:59:54 +0000 (-0600) Subject: More const parms X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7fc634935189abec1d574a9733c7093e5c9f2781;p=p5sagit%2Fp5-mst-13.2.git More const parms Message-ID: <20050314195954.GB7141@petdance.com> p4raw-id: //depot/perl@24042 --- diff --git a/embed.fnc b/embed.fnc index 3658881..282e599 100644 --- a/embed.fnc +++ b/embed.fnc @@ -300,7 +300,7 @@ pd |U32 |intro_my Ap |char* |instr |const char* big|const char* little p |bool |io_close |IO* io|bool not_implicit p |OP* |invert |OP* cmd -dp |bool |is_gv_magical |char *name|STRLEN len|U32 flags +dp |bool |is_gv_magical |const char *name|STRLEN len|U32 flags Ap |I32 |is_lvalue_sub Ap |U32 |to_uni_upper_lc|U32 c Ap |U32 |to_uni_title_lc|U32 c @@ -337,25 +337,25 @@ Ap |bool |is_uni_lower_lc|UV c Ap |bool |is_uni_print_lc|UV c Ap |bool |is_uni_punct_lc|UV c Ap |bool |is_uni_xdigit_lc|UV c -Apd |STRLEN |is_utf8_char |U8 *p -Apd |bool |is_utf8_string |U8 *s|STRLEN len -Apd |bool |is_utf8_string_loc|U8 *s|STRLEN len|U8 **p -Ap |bool |is_utf8_alnum |U8 *p -Ap |bool |is_utf8_alnumc |U8 *p -Ap |bool |is_utf8_idfirst|U8 *p -Ap |bool |is_utf8_idcont |U8 *p -Ap |bool |is_utf8_alpha |U8 *p -Ap |bool |is_utf8_ascii |U8 *p -Ap |bool |is_utf8_space |U8 *p -Ap |bool |is_utf8_cntrl |U8 *p -Ap |bool |is_utf8_digit |U8 *p -Ap |bool |is_utf8_graph |U8 *p -Ap |bool |is_utf8_upper |U8 *p -Ap |bool |is_utf8_lower |U8 *p -Ap |bool |is_utf8_print |U8 *p -Ap |bool |is_utf8_punct |U8 *p -Ap |bool |is_utf8_xdigit |U8 *p -Ap |bool |is_utf8_mark |U8 *p +Apd |STRLEN |is_utf8_char |const U8 *p +Apd |bool |is_utf8_string |const U8 *s|STRLEN len +Apd |bool |is_utf8_string_loc|const U8 *s|STRLEN len|const U8 **p +Ap |bool |is_utf8_alnum |const U8 *p +Ap |bool |is_utf8_alnumc |const U8 *p +Ap |bool |is_utf8_idfirst|const U8 *p +Ap |bool |is_utf8_idcont |const U8 *p +Ap |bool |is_utf8_alpha |const U8 *p +Ap |bool |is_utf8_ascii |const U8 *p +Ap |bool |is_utf8_space |const U8 *p +Ap |bool |is_utf8_cntrl |const U8 *p +Ap |bool |is_utf8_digit |const U8 *p +Ap |bool |is_utf8_graph |const U8 *p +Ap |bool |is_utf8_upper |const U8 *p +Ap |bool |is_utf8_lower |const U8 *p +Ap |bool |is_utf8_print |const U8 *p +Ap |bool |is_utf8_punct |const U8 *p +Ap |bool |is_utf8_xdigit |const U8 *p +Ap |bool |is_utf8_mark |const U8 *p p |OP* |jmaybe |OP* arg p |I32 |keyword |char* d|I32 len Ap |void |leave_scope |I32 base @@ -372,11 +372,11 @@ Apd |void |load_module|U32 flags|SV* name|SV* ver|... Ap |void |vload_module|U32 flags|SV* name|SV* ver|va_list* args p |OP* |localize |OP* arg|I32 lexical Apd |I32 |looks_like_number|SV* sv -Apd |UV |grok_bin |char* start|STRLEN* len|I32* flags|NV *result -Apd |UV |grok_hex |char* start|STRLEN* len|I32* flags|NV *result +Apd |UV |grok_bin |const char* start|STRLEN* len|I32* flags|NV *result +Apd |UV |grok_hex |const char* start|STRLEN* len|I32* flags|NV *result Apd |int |grok_number |const char *pv|STRLEN len|UV *valuep Apd |bool |grok_numeric_radix|const char **sp|const char *send -Apd |UV |grok_oct |char* start|STRLEN* len|I32* flags|NV *result +Apd |UV |grok_oct |const char* start|STRLEN* len|I32* flags|NV *result p |int |magic_clearenv |SV* sv|MAGIC* mg p |int |magic_clear_all_env|SV* sv|MAGIC* mg p |int |magic_clearpack|SV* sv|MAGIC* mg @@ -803,17 +803,15 @@ Apd |void |sv_vsetpvfn |SV* sv|const char* pat|STRLEN patlen \ |va_list* args|SV** svargs|I32 svmax \ |bool *maybe_tainted Ap |NV |str_to_version |SV *sv -Ap |SV* |swash_init |char* pkg|char* name|SV* listsv \ - |I32 minbits|I32 none -Ap |UV |swash_fetch |SV *sv|U8 *ptr|bool do_utf8 +Ap |SV* |swash_init |const char* pkg|const char* name|SV* listsv|I32 minbits|I32 none +Ap |UV |swash_fetch |SV *sv|const U8 *ptr|bool do_utf8 Ap |void |taint_env Ap |void |taint_proper |const char* f|const char* s -Apd |UV |to_utf8_case |U8 *p|U8* ustrp|STRLEN *lenp \ - |SV **swash|char *normal|char *special -Apd |UV |to_utf8_lower |U8 *p|U8* ustrp|STRLEN *lenp -Apd |UV |to_utf8_upper |U8 *p|U8* ustrp|STRLEN *lenp -Apd |UV |to_utf8_title |U8 *p|U8* ustrp|STRLEN *lenp -Apd |UV |to_utf8_fold |U8 *p|U8* ustrp|STRLEN *lenp +Apd |UV |to_utf8_case |const U8 *p|U8* ustrp|STRLEN *lenp|SV **swash|char *normal|char *special +Apd |UV |to_utf8_lower |const U8 *p|U8* ustrp|STRLEN *lenp +Apd |UV |to_utf8_upper |const U8 *p|U8* ustrp|STRLEN *lenp +Apd |UV |to_utf8_title |const U8 *p|U8* ustrp|STRLEN *lenp +Apd |UV |to_utf8_fold |const U8 *p|U8* ustrp|STRLEN *lenp #if defined(UNLINK_ALL_VERSIONS) Ap |I32 |unlnk |char* f #endif @@ -830,10 +828,10 @@ Apd |U8* |utf8_hop |U8 *s|I32 off ApMd |U8* |utf8_to_bytes |U8 *s|STRLEN *len ApMd |U8* |bytes_from_utf8|U8 *s|STRLEN *len|bool *is_utf8 ApMd |U8* |bytes_to_utf8 |const U8 *s|STRLEN *len -Apd |UV |utf8_to_uvchr |U8 *s|STRLEN* retlen -Apd |UV |utf8_to_uvuni |U8 *s|STRLEN* retlen -Adp |UV |utf8n_to_uvchr |U8 *s|STRLEN curlen|STRLEN* retlen|U32 flags -Adp |UV |utf8n_to_uvuni |U8 *s|STRLEN curlen|STRLEN* retlen|U32 flags +Apd |UV |utf8_to_uvchr |const U8 *s|STRLEN* retlen +Apd |UV |utf8_to_uvuni |const U8 *s|STRLEN* retlen +Adp |UV |utf8n_to_uvchr |const U8 *s|STRLEN curlen|STRLEN* retlen|U32 flags +Adp |UV |utf8n_to_uvuni |const U8 *s|STRLEN curlen|STRLEN* retlen|U32 flags Apd |U8* |uvchr_to_utf8 |U8 *d|UV uv Ap |U8* |uvuni_to_utf8 |U8 *d|UV uv Ap |U8* |uvchr_to_utf8_flags |U8 *d|UV uv|UV flags @@ -1264,8 +1262,8 @@ s |I32 |sublex_done s |I32 |sublex_push s |I32 |sublex_start s |char * |filter_gets |SV *sv|PerlIO *fp|STRLEN append -s |HV * |find_in_my_stash|char *pkgname|I32 len -s |SV* |new_constant |char *s|STRLEN len|const char *key|SV *sv \ +s |HV * |find_in_my_stash|const char *pkgname|I32 len +s |SV* |new_constant |const char *s|STRLEN len|const char *key|SV *sv \ |SV *pv|const char *type # if defined(DEBUGGING) s |int |tokereport |char *s|I32 rv diff --git a/gv.c b/gv.c index 3ff4176..bc141f5 100644 --- a/gv.c +++ b/gv.c @@ -1832,7 +1832,7 @@ Perl_amagic_call(pTHX_ SV *left, SV *right, int method, int flags) } /* -=for apidoc is_gv_magical +=for apidoc is_gv_magical_sv Returns C if given the name of a magical GV. Calls is_gv_magical. @@ -1865,7 +1865,7 @@ pointers returned by SvPV. =cut */ bool -Perl_is_gv_magical(pTHX_ char *name, STRLEN len, U32 flags) +Perl_is_gv_magical(pTHX_ const char *name, STRLEN len, U32 flags) { if (len > 1) { const char *name1 = name + 1; @@ -1913,7 +1913,7 @@ Perl_is_gv_magical(pTHX_ char *name, STRLEN len, U32 flags) case '8': case '9': { - char *end = name + len; + const char *end = name + len; while (--end > name) { if (!isDIGIT(*end)) return FALSE; diff --git a/numeric.c b/numeric.c index a6d9c90..227540f 100644 --- a/numeric.c +++ b/numeric.c @@ -129,7 +129,7 @@ invalid character will also trigger a warning. On return I<*len> is set to the length of the scanned string, and I<*flags> gives output flags. -If the value is <= UV_MAX it is returned as a UV, the output flags are clear, +If the value is <= C it is returned as a UV, the output flags are clear, and nothing is written to I<*result>. If the value is > UV_MAX C returns UV_MAX, sets C in the output flags, and writes the value to I<*result> (or the value is discarded if I @@ -144,15 +144,16 @@ number may use '_' characters to separate digits. */ UV -Perl_grok_bin(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result) { +Perl_grok_bin(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) { const char *s = start; STRLEN len = *len_p; UV value = 0; NV value_nv = 0; const UV max_div_2 = UV_MAX / 2; - bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; + const bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; bool overflowed = FALSE; + char bit; if (!(*flags & PERL_SCAN_DISALLOW_PREFIX)) { /* strip off leading b or 0b. @@ -170,8 +171,7 @@ Perl_grok_bin(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result) { } } - for (; len-- && *s; s++) { - char bit = *s; + for (; len-- && (bit = *s); s++) { if (bit == '0' || bit == '1') { /* Write it in this wonky order with a goto to attempt to get the compiler to make the common case integer-only loop pretty tight. @@ -260,14 +260,14 @@ number may use '_' characters to separate digits. */ UV -Perl_grok_hex(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result) { +Perl_grok_hex(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) { const char *s = start; STRLEN len = *len_p; UV value = 0; NV value_nv = 0; const UV max_div_16 = UV_MAX / 16; - bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; + const bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; bool overflowed = FALSE; const char *hexdigit; @@ -375,14 +375,14 @@ number may use '_' characters to separate digits. */ UV -Perl_grok_oct(pTHX_ char *start, STRLEN *len_p, I32 *flags, NV *result) { +Perl_grok_oct(pTHX_ const char *start, STRLEN *len_p, I32 *flags, NV *result) { const char *s = start; STRLEN len = *len_p; UV value = 0; NV value_nv = 0; const UV max_div_8 = UV_MAX / 8; - bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; + const bool allow_underscores = *flags & PERL_SCAN_ALLOW_UNDERSCORES; bool overflowed = FALSE; for (; len-- && *s; s++) { diff --git a/op.c b/op.c index 6631fe3..cb5be23 100644 --- a/op.c +++ b/op.c @@ -4300,7 +4300,7 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block) } } if (const_sv) { - SvREFCNT_inc(const_sv); + (void)SvREFCNT_inc(const_sv); if (cv) { assert(!CvROOT(cv) && !CvCONST(cv)); sv_setpv((SV*)cv, ""); /* prototype is "" */ @@ -5514,7 +5514,7 @@ Perl_ck_glob(pTHX_ OP *o) gv = gv_fetchpv("CORE::GLOBAL::glob", FALSE, SVt_PVCV); glob_gv = gv_fetchpv("File::Glob::csh_glob", FALSE, SVt_PVCV); GvCV(gv) = GvCV(glob_gv); - SvREFCNT_inc((SV*)GvCV(gv)); + (void)SvREFCNT_inc((SV*)GvCV(gv)); GvIMPORTED_CV_on(gv); LEAVE; } diff --git a/pad.c b/pad.c index 1330894..132965d 100644 --- a/pad.c +++ b/pad.c @@ -259,7 +259,7 @@ Perl_pad_undef(pTHX_ CV* cv) if (namesv && namesv != &PL_sv_undef && *SvPVX(namesv) == '&') { - CV *innercv = (CV*)curpad[ix]; + CV * const innercv = (CV*)curpad[ix]; namepad[ix] = Nullsv; SvREFCNT_dec(namesv); @@ -276,7 +276,7 @@ Perl_pad_undef(pTHX_ CV* cv) CvWEAKOUTSIDE_off(innercv); CvOUTSIDE(innercv) = outercv; CvOUTSIDE_SEQ(innercv) = seq; - SvREFCNT_inc(outercv); + (void)SvREFCNT_inc(outercv); } else { CvOUTSIDE(innercv) = Nullcv; diff --git a/perlio.c b/perlio.c index 768b8eb..30ae8ea 100644 --- a/perlio.c +++ b/perlio.c @@ -610,7 +610,7 @@ PerlIO_list_push(pTHX_ PerlIO_list_t *list, PerlIO_funcs *funcs, SV *arg) p = &(list->array[list->cur++]); p->funcs = funcs; if ((p->arg = arg)) { - SvREFCNT_inc(arg); + (void)SvREFCNT_inc(arg); } } diff --git a/pod/perlapi.pod b/pod/perlapi.pod index bf1256f..3b493ea 100644 --- a/pod/perlapi.pod +++ b/pod/perlapi.pod @@ -2031,7 +2031,7 @@ invalid character will also trigger a warning. On return I<*len> is set to the length of the scanned string, and I<*flags> gives output flags. -If the value is <= UV_MAX it is returned as a UV, the output flags are clear, +If the value is <= C it is returned as a UV, the output flags are clear, and nothing is written to I<*result>. If the value is > UV_MAX C returns UV_MAX, sets C in the output flags, and writes the value to I<*result> (or the value is discarded if I @@ -2042,7 +2042,7 @@ C is set in I<*flags> on entry. If C is set in I<*flags> then the binary number may use '_' characters to separate digits. - UV grok_bin(char* start, STRLEN* len, I32* flags, NV *result) + UV grok_bin(const char* start, STRLEN* len, I32* flags, NV *result) =for hackers Found in file numeric.c @@ -2070,7 +2070,7 @@ C is set in I<*flags> on entry. If C is set in I<*flags> then the hex number may use '_' characters to separate digits. - UV grok_hex(char* start, STRLEN* len, I32* flags, NV *result) + UV grok_hex(const char* start, STRLEN* len, I32* flags, NV *result) =for hackers Found in file numeric.c @@ -2130,7 +2130,7 @@ is NULL). If C is set in I<*flags> then the octal number may use '_' characters to separate digits. - UV grok_oct(char* start, STRLEN* len, I32* flags, NV *result) + UV grok_oct(const char* start, STRLEN* len, I32* flags, NV *result) =for hackers Found in file numeric.c @@ -5226,7 +5226,7 @@ character. Note that an INVARIANT (i.e. ASCII) character is a valid UTF-8 character. The actual number of bytes in the UTF-8 character will be returned if it is valid, otherwise 0. - STRLEN is_utf8_char(U8 *p) + STRLEN is_utf8_char(const U8 *p) =for hackers Found in file utf8.c @@ -5238,7 +5238,7 @@ UTF-8 string, false otherwise. Note that 'a valid UTF-8 string' does not mean 'a string that contains code points above 0x7F encoded in UTF-8' because a valid ASCII string is a valid UTF-8 string. - bool is_utf8_string(U8 *s, STRLEN len) + bool is_utf8_string(const U8 *s, STRLEN len) =for hackers Found in file utf8.c @@ -5248,7 +5248,7 @@ Found in file utf8.c Like is_ut8_string but store the location of the failure in the last argument. - bool is_utf8_string_loc(U8 *s, STRLEN len, U8 **p) + bool is_utf8_string_loc(const U8 *s, STRLEN len, const U8 **p) =for hackers Found in file utf8.c @@ -5345,7 +5345,7 @@ Perl_to_utf8_case(). The "normal" is a string like "ToLower" which means the swash %utf8::ToLower. - UV to_utf8_case(U8 *p, U8* ustrp, STRLEN *lenp, SV **swash, char *normal, char *special) + UV to_utf8_case(const U8 *p, U8* ustrp, STRLEN *lenp, SV **swash, char *normal, char *special) =for hackers Found in file utf8.c @@ -5361,7 +5361,7 @@ three characters). The first character of the foldcased version is returned (but note, as explained above, that there may be more.) - UV to_utf8_fold(U8 *p, U8* ustrp, STRLEN *lenp) + UV to_utf8_fold(const U8 *p, U8* ustrp, STRLEN *lenp) =for hackers Found in file utf8.c @@ -5376,7 +5376,7 @@ lowercase version may be longer than the original character. The first character of the lowercased version is returned (but note, as explained above, that there may be more.) - UV to_utf8_lower(U8 *p, U8* ustrp, STRLEN *lenp) + UV to_utf8_lower(const U8 *p, U8* ustrp, STRLEN *lenp) =for hackers Found in file utf8.c @@ -5391,7 +5391,7 @@ titlecase version may be longer than the original character. The first character of the titlecased version is returned (but note, as explained above, that there may be more.) - UV to_utf8_title(U8 *p, U8* ustrp, STRLEN *lenp) + UV to_utf8_title(const U8 *p, U8* ustrp, STRLEN *lenp) =for hackers Found in file utf8.c @@ -5406,7 +5406,7 @@ the uppercase version may be longer than the original character. The first character of the uppercased version is returned (but note, as explained above, that there may be more.) - UV to_utf8_upper(U8 *p, U8* ustrp, STRLEN *lenp) + UV to_utf8_upper(const U8 *p, U8* ustrp, STRLEN *lenp) =for hackers Found in file utf8.c @@ -5419,7 +5419,7 @@ length, in bytes, of that character. Allows length and flags to be passed to low level routine. - UV utf8n_to_uvchr(U8 *s, STRLEN curlen, STRLEN* retlen, U32 flags) + UV utf8n_to_uvchr(const U8 *s, STRLEN curlen, STRLEN* retlen, U32 flags) =for hackers Found in file utf8.c @@ -5444,7 +5444,7 @@ the strict UTF-8 encoding (see F). Most code should use utf8_to_uvchr() rather than call this directly. - UV utf8n_to_uvuni(U8 *s, STRLEN curlen, STRLEN* retlen, U32 flags) + UV utf8n_to_uvuni(const U8 *s, STRLEN curlen, STRLEN* retlen, U32 flags) =for hackers Found in file utf8.c @@ -5511,7 +5511,7 @@ length, in bytes, of that character. If C does not point to a well-formed UTF-8 character, zero is returned and retlen is set, if possible, to -1. - UV utf8_to_uvchr(U8 *s, STRLEN* retlen) + UV utf8_to_uvchr(const U8 *s, STRLEN* retlen) =for hackers Found in file utf8.c @@ -5528,7 +5528,7 @@ an index into the Unicode semantic tables (e.g. swashes). If C does not point to a well-formed UTF-8 character, zero is returned and retlen is set, if possible, to -1. - UV utf8_to_uvuni(U8 *s, STRLEN* retlen) + UV utf8_to_uvuni(const U8 *s, STRLEN* retlen) =for hackers Found in file utf8.c diff --git a/pod/perlintern.pod b/pod/perlintern.pod index d50cbbd..1d04a5d 100644 --- a/pod/perlintern.pod +++ b/pod/perlintern.pod @@ -404,7 +404,16 @@ Currently assumes that C is NUL terminated (as well as len being valid). This assumption is met by all callers within the perl core, which all pass pointers returned by SvPV. - bool is_gv_magical(char *name, STRLEN len, U32 flags) + bool is_gv_magical(const char *name, STRLEN len, U32 flags) + +=for hackers +Found in file gv.c + +=item is_gv_magical_sv + +Returns C if given the name of a magical GV. Calls is_gv_magical. + + bool is_gv_magical_sv(SV *name, U32 flags) =for hackers Found in file gv.c diff --git a/pp_ctl.c b/pp_ctl.c index 40c3b22..80ca824 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -2266,9 +2266,9 @@ PP(pp_goto) retry: if (!CvROOT(cv) && !CvXSUB(cv)) { - GV *gv = CvGV(cv); - GV *autogv; + const GV * const gv = CvGV(cv); if (gv) { + GV *autogv; SV *tmpstr; /* autoloaded stub? */ if (cv != GvCV(gv) && (cv = GvCV(gv))) @@ -2285,7 +2285,7 @@ PP(pp_goto) } /* First do some returnish stuff. */ - SvREFCNT_inc(cv); /* avoid premature free during unwind */ + (void)SvREFCNT_inc(cv); /* avoid premature free during unwind */ FREETMPS; cxix = dopoptosub(cxstack_ix); if (cxix < 0) diff --git a/pp_hot.c b/pp_hot.c index a511772..99c6aff 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -1622,9 +1622,9 @@ Perl_do_readline(pTHX) continue; } } else if (SvUTF8(sv)) { /* OP_READLINE, OP_RCATLINE */ - U8 *s = (U8*)SvPVX(sv) + offset; - STRLEN len = SvCUR(sv) - offset; - U8 *f; + const U8 *s = (U8*)SvPVX(sv) + offset; + const STRLEN len = SvCUR(sv) - offset; + const U8 *f; if (ckWARN(WARN_UTF8) && !Perl_is_utf8_string_loc(aTHX_ s, len, &f)) diff --git a/proto.h b/proto.h index 41513ad..bb90daa 100644 --- a/proto.h +++ b/proto.h @@ -277,7 +277,7 @@ PERL_CALLCONV U32 Perl_intro_my(pTHX); PERL_CALLCONV char* Perl_instr(pTHX_ const char* big, const char* little); PERL_CALLCONV bool Perl_io_close(pTHX_ IO* io, bool not_implicit); PERL_CALLCONV OP* Perl_invert(pTHX_ OP* cmd); -PERL_CALLCONV bool Perl_is_gv_magical(pTHX_ char *name, STRLEN len, U32 flags); +PERL_CALLCONV bool Perl_is_gv_magical(pTHX_ const char *name, STRLEN len, U32 flags); PERL_CALLCONV I32 Perl_is_lvalue_sub(pTHX); PERL_CALLCONV U32 Perl_to_uni_upper_lc(pTHX_ U32 c); PERL_CALLCONV U32 Perl_to_uni_title_lc(pTHX_ U32 c); @@ -314,25 +314,25 @@ PERL_CALLCONV bool Perl_is_uni_lower_lc(pTHX_ UV c); PERL_CALLCONV bool Perl_is_uni_print_lc(pTHX_ UV c); PERL_CALLCONV bool Perl_is_uni_punct_lc(pTHX_ UV c); PERL_CALLCONV bool Perl_is_uni_xdigit_lc(pTHX_ UV c); -PERL_CALLCONV STRLEN Perl_is_utf8_char(pTHX_ U8 *p); -PERL_CALLCONV bool Perl_is_utf8_string(pTHX_ U8 *s, STRLEN len); -PERL_CALLCONV bool Perl_is_utf8_string_loc(pTHX_ U8 *s, STRLEN len, U8 **p); -PERL_CALLCONV bool Perl_is_utf8_alnum(pTHX_ U8 *p); -PERL_CALLCONV bool Perl_is_utf8_alnumc(pTHX_ U8 *p); -PERL_CALLCONV bool Perl_is_utf8_idfirst(pTHX_ U8 *p); -PERL_CALLCONV bool Perl_is_utf8_idcont(pTHX_ U8 *p); -PERL_CALLCONV bool Perl_is_utf8_alpha(pTHX_ U8 *p); -PERL_CALLCONV bool Perl_is_utf8_ascii(pTHX_ U8 *p); -PERL_CALLCONV bool Perl_is_utf8_space(pTHX_ U8 *p); -PERL_CALLCONV bool Perl_is_utf8_cntrl(pTHX_ U8 *p); -PERL_CALLCONV bool Perl_is_utf8_digit(pTHX_ U8 *p); -PERL_CALLCONV bool Perl_is_utf8_graph(pTHX_ U8 *p); -PERL_CALLCONV bool Perl_is_utf8_upper(pTHX_ U8 *p); -PERL_CALLCONV bool Perl_is_utf8_lower(pTHX_ U8 *p); -PERL_CALLCONV bool Perl_is_utf8_print(pTHX_ U8 *p); -PERL_CALLCONV bool Perl_is_utf8_punct(pTHX_ U8 *p); -PERL_CALLCONV bool Perl_is_utf8_xdigit(pTHX_ U8 *p); -PERL_CALLCONV bool Perl_is_utf8_mark(pTHX_ U8 *p); +PERL_CALLCONV STRLEN Perl_is_utf8_char(pTHX_ const U8 *p); +PERL_CALLCONV bool Perl_is_utf8_string(pTHX_ const U8 *s, STRLEN len); +PERL_CALLCONV bool Perl_is_utf8_string_loc(pTHX_ const U8 *s, STRLEN len, const U8 **p); +PERL_CALLCONV bool Perl_is_utf8_alnum(pTHX_ const U8 *p); +PERL_CALLCONV bool Perl_is_utf8_alnumc(pTHX_ const U8 *p); +PERL_CALLCONV bool Perl_is_utf8_idfirst(pTHX_ const U8 *p); +PERL_CALLCONV bool Perl_is_utf8_idcont(pTHX_ const U8 *p); +PERL_CALLCONV bool Perl_is_utf8_alpha(pTHX_ const U8 *p); +PERL_CALLCONV bool Perl_is_utf8_ascii(pTHX_ const U8 *p); +PERL_CALLCONV bool Perl_is_utf8_space(pTHX_ const U8 *p); +PERL_CALLCONV bool Perl_is_utf8_cntrl(pTHX_ const U8 *p); +PERL_CALLCONV bool Perl_is_utf8_digit(pTHX_ const U8 *p); +PERL_CALLCONV bool Perl_is_utf8_graph(pTHX_ const U8 *p); +PERL_CALLCONV bool Perl_is_utf8_upper(pTHX_ const U8 *p); +PERL_CALLCONV bool Perl_is_utf8_lower(pTHX_ const U8 *p); +PERL_CALLCONV bool Perl_is_utf8_print(pTHX_ const U8 *p); +PERL_CALLCONV bool Perl_is_utf8_punct(pTHX_ const U8 *p); +PERL_CALLCONV bool Perl_is_utf8_xdigit(pTHX_ const U8 *p); +PERL_CALLCONV bool Perl_is_utf8_mark(pTHX_ const U8 *p); PERL_CALLCONV OP* Perl_jmaybe(pTHX_ OP* arg); PERL_CALLCONV I32 Perl_keyword(pTHX_ char* d, I32 len); PERL_CALLCONV void Perl_leave_scope(pTHX_ I32 base); @@ -349,11 +349,11 @@ PERL_CALLCONV void Perl_load_module(pTHX_ U32 flags, SV* name, SV* ver, ...); PERL_CALLCONV void Perl_vload_module(pTHX_ U32 flags, SV* name, SV* ver, va_list* args); PERL_CALLCONV OP* Perl_localize(pTHX_ OP* arg, I32 lexical); PERL_CALLCONV I32 Perl_looks_like_number(pTHX_ SV* sv); -PERL_CALLCONV UV Perl_grok_bin(pTHX_ char* start, STRLEN* len, I32* flags, NV *result); -PERL_CALLCONV UV Perl_grok_hex(pTHX_ char* start, STRLEN* len, I32* flags, NV *result); +PERL_CALLCONV UV Perl_grok_bin(pTHX_ const char* start, STRLEN* len, I32* flags, NV *result); +PERL_CALLCONV UV Perl_grok_hex(pTHX_ const char* start, STRLEN* len, I32* flags, NV *result); PERL_CALLCONV int Perl_grok_number(pTHX_ const char *pv, STRLEN len, UV *valuep); PERL_CALLCONV bool Perl_grok_numeric_radix(pTHX_ const char **sp, const char *send); -PERL_CALLCONV UV Perl_grok_oct(pTHX_ char* start, STRLEN* len, I32* flags, NV *result); +PERL_CALLCONV UV Perl_grok_oct(pTHX_ const char* start, STRLEN* len, I32* flags, NV *result); PERL_CALLCONV int Perl_magic_clearenv(pTHX_ SV* sv, MAGIC* mg); PERL_CALLCONV int Perl_magic_clear_all_env(pTHX_ SV* sv, MAGIC* mg); PERL_CALLCONV int Perl_magic_clearpack(pTHX_ SV* sv, MAGIC* mg); @@ -764,15 +764,15 @@ PERL_CALLCONV void Perl_sv_usepvn(pTHX_ SV* sv, char* ptr, STRLEN len); PERL_CALLCONV void Perl_sv_vcatpvfn(pTHX_ SV* sv, const char* pat, STRLEN patlen, va_list* args, SV** svargs, I32 svmax, bool *maybe_tainted); PERL_CALLCONV void Perl_sv_vsetpvfn(pTHX_ SV* sv, const char* pat, STRLEN patlen, va_list* args, SV** svargs, I32 svmax, bool *maybe_tainted); PERL_CALLCONV NV Perl_str_to_version(pTHX_ SV *sv); -PERL_CALLCONV SV* Perl_swash_init(pTHX_ char* pkg, char* name, SV* listsv, I32 minbits, I32 none); -PERL_CALLCONV UV Perl_swash_fetch(pTHX_ SV *sv, U8 *ptr, bool do_utf8); +PERL_CALLCONV SV* Perl_swash_init(pTHX_ const char* pkg, const char* name, SV* listsv, I32 minbits, I32 none); +PERL_CALLCONV UV Perl_swash_fetch(pTHX_ SV *sv, const U8 *ptr, bool do_utf8); PERL_CALLCONV void Perl_taint_env(pTHX); PERL_CALLCONV void Perl_taint_proper(pTHX_ const char* f, const char* s); -PERL_CALLCONV UV Perl_to_utf8_case(pTHX_ U8 *p, U8* ustrp, STRLEN *lenp, SV **swash, char *normal, char *special); -PERL_CALLCONV UV Perl_to_utf8_lower(pTHX_ U8 *p, U8* ustrp, STRLEN *lenp); -PERL_CALLCONV UV Perl_to_utf8_upper(pTHX_ U8 *p, U8* ustrp, STRLEN *lenp); -PERL_CALLCONV UV Perl_to_utf8_title(pTHX_ U8 *p, U8* ustrp, STRLEN *lenp); -PERL_CALLCONV UV Perl_to_utf8_fold(pTHX_ U8 *p, U8* ustrp, STRLEN *lenp); +PERL_CALLCONV UV Perl_to_utf8_case(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, SV **swash, char *normal, char *special); +PERL_CALLCONV UV Perl_to_utf8_lower(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp); +PERL_CALLCONV UV Perl_to_utf8_upper(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp); +PERL_CALLCONV UV Perl_to_utf8_title(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp); +PERL_CALLCONV UV Perl_to_utf8_fold(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp); #if defined(UNLINK_ALL_VERSIONS) PERL_CALLCONV I32 Perl_unlnk(pTHX_ char* f); #endif @@ -789,10 +789,10 @@ PERL_CALLCONV U8* Perl_utf8_hop(pTHX_ U8 *s, I32 off); PERL_CALLCONV U8* Perl_utf8_to_bytes(pTHX_ U8 *s, STRLEN *len); PERL_CALLCONV U8* Perl_bytes_from_utf8(pTHX_ U8 *s, STRLEN *len, bool *is_utf8); PERL_CALLCONV U8* Perl_bytes_to_utf8(pTHX_ const U8 *s, STRLEN *len); -PERL_CALLCONV UV Perl_utf8_to_uvchr(pTHX_ U8 *s, STRLEN* retlen); -PERL_CALLCONV UV Perl_utf8_to_uvuni(pTHX_ U8 *s, STRLEN* retlen); -PERL_CALLCONV UV Perl_utf8n_to_uvchr(pTHX_ U8 *s, STRLEN curlen, STRLEN* retlen, U32 flags); -PERL_CALLCONV UV Perl_utf8n_to_uvuni(pTHX_ U8 *s, STRLEN curlen, STRLEN* retlen, U32 flags); +PERL_CALLCONV UV Perl_utf8_to_uvchr(pTHX_ const U8 *s, STRLEN* retlen); +PERL_CALLCONV UV Perl_utf8_to_uvuni(pTHX_ const U8 *s, STRLEN* retlen); +PERL_CALLCONV UV Perl_utf8n_to_uvchr(pTHX_ const U8 *s, STRLEN curlen, STRLEN* retlen, U32 flags); +PERL_CALLCONV UV Perl_utf8n_to_uvuni(pTHX_ const U8 *s, STRLEN curlen, STRLEN* retlen, U32 flags); PERL_CALLCONV U8* Perl_uvchr_to_utf8(pTHX_ U8 *d, UV uv); PERL_CALLCONV U8* Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv); PERL_CALLCONV U8* Perl_uvchr_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags); @@ -1212,8 +1212,8 @@ STATIC I32 S_sublex_done(pTHX); STATIC I32 S_sublex_push(pTHX); STATIC I32 S_sublex_start(pTHX); STATIC char * S_filter_gets(pTHX_ SV *sv, PerlIO *fp, STRLEN append); -STATIC HV * S_find_in_my_stash(pTHX_ char *pkgname, I32 len); -STATIC SV* S_new_constant(pTHX_ char *s, STRLEN len, const char *key, SV *sv, SV *pv, const char *type); +STATIC HV * S_find_in_my_stash(pTHX_ const char *pkgname, I32 len); +STATIC SV* S_new_constant(pTHX_ const char *s, STRLEN len, const char *key, SV *sv, SV *pv, const char *type); # if defined(DEBUGGING) STATIC int S_tokereport(pTHX_ char *s, I32 rv); # endif diff --git a/scope.c b/scope.c index c4edd17..debdd4b 100644 --- a/scope.c +++ b/scope.c @@ -592,7 +592,7 @@ Perl_save_aelem(pTHX_ const AV *av, I32 idx, SV **sptr) SSPUSHINT(SAVEt_AELEM); /* if it gets reified later, the restore will have the wrong refcnt */ if (!AvREAL(av) && AvREIFY(av)) - SvREFCNT_inc(*sptr); + (void)SvREFCNT_inc(*sptr); save_scalar_at(sptr); sv = *sptr; /* If we're localizing a tied array element, this new sv diff --git a/sv.c b/sv.c index 343c5f0..98fd4c6 100644 --- a/sv.c +++ b/sv.c @@ -10388,10 +10388,10 @@ Perl_mg_dup(pTHX_ MAGIC *mg, CLONE_PARAMS* param) nmg->mg_obj = (SV*)re_dup((REGEXP*)mg->mg_obj, param); } else if(mg->mg_type == PERL_MAGIC_backref) { - AV *av = (AV*) mg->mg_obj; + const AV * const av = (AV*) mg->mg_obj; SV **svp; I32 i; - SvREFCNT_inc(nmg->mg_obj = (SV*)newAV()); + (void)SvREFCNT_inc(nmg->mg_obj = (SV*)newAV()); svp = AvARRAY(av); for (i = AvFILLp(av); i >= 0; i--) { if (!svp[i]) continue; diff --git a/toke.c b/toke.c index 314c040..7cfe133 100644 --- a/toke.c +++ b/toke.c @@ -2247,7 +2247,7 @@ S_filter_gets(pTHX_ register SV *sv, register PerlIO *fp, STRLEN append) } STATIC HV * -S_find_in_my_stash(pTHX_ char *pkgname, I32 len) +S_find_in_my_stash(pTHX_ const char *pkgname, I32 len) { GV *gv; @@ -8938,7 +8938,7 @@ S_checkcomma(pTHX_ register char *s, char *name, char *what) and type is used with error messages only. */ STATIC SV * -S_new_constant(pTHX_ char *s, STRLEN len, const char *key, SV *sv, SV *pv, +S_new_constant(pTHX_ const char *s, STRLEN len, const char *key, SV *sv, SV *pv, const char *type) { dSP; diff --git a/utf8.c b/utf8.c index ab49b9e..905ff85 100644 --- a/utf8.c +++ b/utf8.c @@ -174,7 +174,7 @@ Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv) /* -=for apidoc A|STRLEN|is_utf8_char|U8 *s +=for apidoc A|STRLEN|is_utf8_char|const U8 *s Tests if some arbitrary number of bytes begins in a valid UTF-8 character. Note that an INVARIANT (i.e. ASCII) character is a valid @@ -183,7 +183,7 @@ will be returned if it is valid, otherwise 0. =cut */ STRLEN -Perl_is_utf8_char(pTHX_ U8 *s) +Perl_is_utf8_char(pTHX_ const U8 *s) { U8 u = *s; STRLEN slen, len; @@ -222,7 +222,7 @@ Perl_is_utf8_char(pTHX_ U8 *s) } /* -=for apidoc A|bool|is_utf8_string|U8 *s|STRLEN len +=for apidoc A|bool|is_utf8_string|const U8 *s|STRLEN len Returns true if first C bytes of the given string form a valid UTF-8 string, false otherwise. Note that 'a valid UTF-8 string' does @@ -233,10 +233,10 @@ because a valid ASCII string is a valid UTF-8 string. */ bool -Perl_is_utf8_string(pTHX_ U8 *s, STRLEN len) +Perl_is_utf8_string(pTHX_ const U8 *s, STRLEN len) { - U8* x = s; - U8* send; + const U8* x = s; + const U8* send; STRLEN c; if (!len && s) @@ -264,7 +264,7 @@ Perl_is_utf8_string(pTHX_ U8 *s, STRLEN len) } /* -=for apidoc A|bool|is_utf8_string_loc|U8 *s|STRLEN len|U8 **p +=for apidoc A|bool|is_utf8_string_loc|const U8 *s|STRLEN len|const U8 **p Like is_ut8_string but store the location of the failure in the last argument. @@ -273,10 +273,10 @@ the last argument. */ bool -Perl_is_utf8_string_loc(pTHX_ U8 *s, STRLEN len, U8 **p) +Perl_is_utf8_string_loc(pTHX_ const U8 *s, STRLEN len, const U8 **p) { - U8* x = s; - U8* send; + const U8* x = s; + const U8* send; STRLEN c; if (!len && s) @@ -313,7 +313,7 @@ Perl_is_utf8_string_loc(pTHX_ U8 *s, STRLEN len, U8 **p) } /* -=for apidoc A|UV|utf8n_to_uvuni|U8 *s|STRLEN curlen|STRLEN *retlen|U32 flags +=for apidoc A|UV|utf8n_to_uvuni|const U8 *s|STRLEN curlen|STRLEN *retlen|U32 flags Bottom level UTF-8 decode routine. Returns the unicode code point value of the first character in the string C @@ -337,13 +337,13 @@ Most code should use utf8_to_uvchr() rather than call this directly. */ UV -Perl_utf8n_to_uvuni(pTHX_ U8 *s, STRLEN curlen, STRLEN *retlen, U32 flags) +Perl_utf8n_to_uvuni(pTHX_ const U8 *s, STRLEN curlen, STRLEN *retlen, U32 flags) { - U8 *s0 = s; + const U8 *s0 = s; UV uv = *s, ouv = 0; STRLEN len = 1; - bool dowarn = ckWARN_d(WARN_UTF8); - UV startbyte = *s; + const bool dowarn = ckWARN_d(WARN_UTF8); + const UV startbyte = *s; STRLEN expectlen = 0; U32 warning = 0; @@ -537,7 +537,7 @@ malformed: } /* -=for apidoc A|UV|utf8_to_uvchr|U8 *s|STRLEN *retlen +=for apidoc A|UV|utf8_to_uvchr|const U8 *s|STRLEN *retlen Returns the native character value of the first character in the string C which is assumed to be in UTF-8 encoding; C will be set to the @@ -550,14 +550,14 @@ returned and retlen is set, if possible, to -1. */ UV -Perl_utf8_to_uvchr(pTHX_ U8 *s, STRLEN *retlen) +Perl_utf8_to_uvchr(pTHX_ const U8 *s, STRLEN *retlen) { return Perl_utf8n_to_uvchr(aTHX_ s, UTF8_MAXBYTES, retlen, ckWARN(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY); } /* -=for apidoc A|UV|utf8_to_uvuni|U8 *s|STRLEN *retlen +=for apidoc A|UV|utf8_to_uvuni|const U8 *s|STRLEN *retlen Returns the Unicode code point of the first character in the string C which is assumed to be in UTF-8 encoding; C will be set to the @@ -573,7 +573,7 @@ returned and retlen is set, if possible, to -1. */ UV -Perl_utf8_to_uvuni(pTHX_ U8 *s, STRLEN *retlen) +Perl_utf8_to_uvuni(pTHX_ const U8 *s, STRLEN *retlen) { /* Call the low level routine asking for checks */ return Perl_utf8n_to_uvuni(aTHX_ s, UTF8_MAXBYTES, retlen, @@ -1191,7 +1191,7 @@ Perl_to_uni_lower_lc(pTHX_ U32 c) } bool -Perl_is_utf8_alnum(pTHX_ U8 *p) +Perl_is_utf8_alnum(pTHX_ const U8 *p) { if (!is_utf8_char(p)) return FALSE; @@ -1211,7 +1211,7 @@ Perl_is_utf8_alnum(pTHX_ U8 *p) } bool -Perl_is_utf8_alnumc(pTHX_ U8 *p) +Perl_is_utf8_alnumc(pTHX_ const U8 *p) { if (!is_utf8_char(p)) return FALSE; @@ -1228,7 +1228,7 @@ Perl_is_utf8_alnumc(pTHX_ U8 *p) } bool -Perl_is_utf8_idfirst(pTHX_ U8 *p) /* The naming is historical. */ +Perl_is_utf8_idfirst(pTHX_ const U8 *p) /* The naming is historical. */ { if (*p == '_') return TRUE; @@ -1240,7 +1240,7 @@ Perl_is_utf8_idfirst(pTHX_ U8 *p) /* The naming is historical. */ } bool -Perl_is_utf8_idcont(pTHX_ U8 *p) +Perl_is_utf8_idcont(pTHX_ const U8 *p) { if (*p == '_') return TRUE; @@ -1252,7 +1252,7 @@ Perl_is_utf8_idcont(pTHX_ U8 *p) } bool -Perl_is_utf8_alpha(pTHX_ U8 *p) +Perl_is_utf8_alpha(pTHX_ const U8 *p) { if (!is_utf8_char(p)) return FALSE; @@ -1262,7 +1262,7 @@ Perl_is_utf8_alpha(pTHX_ U8 *p) } bool -Perl_is_utf8_ascii(pTHX_ U8 *p) +Perl_is_utf8_ascii(pTHX_ const U8 *p) { if (!is_utf8_char(p)) return FALSE; @@ -1272,7 +1272,7 @@ Perl_is_utf8_ascii(pTHX_ U8 *p) } bool -Perl_is_utf8_space(pTHX_ U8 *p) +Perl_is_utf8_space(pTHX_ const U8 *p) { if (!is_utf8_char(p)) return FALSE; @@ -1282,7 +1282,7 @@ Perl_is_utf8_space(pTHX_ U8 *p) } bool -Perl_is_utf8_digit(pTHX_ U8 *p) +Perl_is_utf8_digit(pTHX_ const U8 *p) { if (!is_utf8_char(p)) return FALSE; @@ -1292,7 +1292,7 @@ Perl_is_utf8_digit(pTHX_ U8 *p) } bool -Perl_is_utf8_upper(pTHX_ U8 *p) +Perl_is_utf8_upper(pTHX_ const U8 *p) { if (!is_utf8_char(p)) return FALSE; @@ -1302,7 +1302,7 @@ Perl_is_utf8_upper(pTHX_ U8 *p) } bool -Perl_is_utf8_lower(pTHX_ U8 *p) +Perl_is_utf8_lower(pTHX_ const U8 *p) { if (!is_utf8_char(p)) return FALSE; @@ -1312,7 +1312,7 @@ Perl_is_utf8_lower(pTHX_ U8 *p) } bool -Perl_is_utf8_cntrl(pTHX_ U8 *p) +Perl_is_utf8_cntrl(pTHX_ const U8 *p) { if (!is_utf8_char(p)) return FALSE; @@ -1322,7 +1322,7 @@ Perl_is_utf8_cntrl(pTHX_ U8 *p) } bool -Perl_is_utf8_graph(pTHX_ U8 *p) +Perl_is_utf8_graph(pTHX_ const U8 *p) { if (!is_utf8_char(p)) return FALSE; @@ -1332,7 +1332,7 @@ Perl_is_utf8_graph(pTHX_ U8 *p) } bool -Perl_is_utf8_print(pTHX_ U8 *p) +Perl_is_utf8_print(pTHX_ const U8 *p) { if (!is_utf8_char(p)) return FALSE; @@ -1342,7 +1342,7 @@ Perl_is_utf8_print(pTHX_ U8 *p) } bool -Perl_is_utf8_punct(pTHX_ U8 *p) +Perl_is_utf8_punct(pTHX_ const U8 *p) { if (!is_utf8_char(p)) return FALSE; @@ -1352,7 +1352,7 @@ Perl_is_utf8_punct(pTHX_ U8 *p) } bool -Perl_is_utf8_xdigit(pTHX_ U8 *p) +Perl_is_utf8_xdigit(pTHX_ const U8 *p) { if (!is_utf8_char(p)) return FALSE; @@ -1362,7 +1362,7 @@ Perl_is_utf8_xdigit(pTHX_ U8 *p) } bool -Perl_is_utf8_mark(pTHX_ U8 *p) +Perl_is_utf8_mark(pTHX_ const U8 *p) { if (!is_utf8_char(p)) return FALSE; @@ -1397,13 +1397,13 @@ The "normal" is a string like "ToLower" which means the swash =cut */ UV -Perl_to_utf8_case(pTHX_ U8 *p, U8* ustrp, STRLEN *lenp, SV **swashp, char *normal, char *special) +Perl_to_utf8_case(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, SV **swashp, char *normal, char *special) { - UV uv0, uv1; + UV uv1; U8 tmpbuf[UTF8_MAXBYTES_CASE+1]; STRLEN len = 0; - uv0 = utf8_to_uvchr(p, 0); + const UV uv0 = utf8_to_uvchr(p, 0); /* The NATIVE_TO_UNI() and UNI_TO_NATIVE() mappings * are necessary in EBCDIC, they are redundant no-ops * in ASCII-ish platforms, and hopefully optimized away. */ @@ -1485,7 +1485,7 @@ Perl_to_utf8_case(pTHX_ U8 *p, U8* ustrp, STRLEN *lenp, SV **swashp, char *norma } /* -=for apidoc A|UV|to_utf8_upper|U8 *p|U8 *ustrp|STRLEN *lenp +=for apidoc A|UV|to_utf8_upper|const U8 *p|U8 *ustrp|STRLEN *lenp Convert the UTF-8 encoded character at p to its uppercase version and store that in UTF-8 in ustrp and its length in bytes in lenp. Note @@ -1498,14 +1498,14 @@ The first character of the uppercased version is returned =cut */ UV -Perl_to_utf8_upper(pTHX_ U8 *p, U8* ustrp, STRLEN *lenp) +Perl_to_utf8_upper(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp) { return Perl_to_utf8_case(aTHX_ p, ustrp, lenp, &PL_utf8_toupper, "ToUpper", "utf8::ToSpecUpper"); } /* -=for apidoc A|UV|to_utf8_title|U8 *p|U8 *ustrp|STRLEN *lenp +=for apidoc A|UV|to_utf8_title|const U8 *p|U8 *ustrp|STRLEN *lenp Convert the UTF-8 encoded character at p to its titlecase version and store that in UTF-8 in ustrp and its length in bytes in lenp. Note @@ -1518,14 +1518,14 @@ The first character of the titlecased version is returned =cut */ UV -Perl_to_utf8_title(pTHX_ U8 *p, U8* ustrp, STRLEN *lenp) +Perl_to_utf8_title(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp) { return Perl_to_utf8_case(aTHX_ p, ustrp, lenp, &PL_utf8_totitle, "ToTitle", "utf8::ToSpecTitle"); } /* -=for apidoc A|UV|to_utf8_lower|U8 *p|U8 *ustrp|STRLEN *lenp +=for apidoc A|UV|to_utf8_lower|const U8 *p|U8 *ustrp|STRLEN *lenp Convert the UTF-8 encoded character at p to its lowercase version and store that in UTF-8 in ustrp and its length in bytes in lenp. Note @@ -1538,14 +1538,14 @@ The first character of the lowercased version is returned =cut */ UV -Perl_to_utf8_lower(pTHX_ U8 *p, U8* ustrp, STRLEN *lenp) +Perl_to_utf8_lower(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp) { return Perl_to_utf8_case(aTHX_ p, ustrp, lenp, &PL_utf8_tolower, "ToLower", "utf8::ToSpecLower"); } /* -=for apidoc A|UV|to_utf8_fold|U8 *p|U8 *ustrp|STRLEN *lenp +=for apidoc A|UV|to_utf8_fold|const U8 *p|U8 *ustrp|STRLEN *lenp Convert the UTF-8 encoded character at p to its foldcase version and store that in UTF-8 in ustrp and its length in bytes in lenp. Note @@ -1559,7 +1559,7 @@ The first character of the foldcased version is returned =cut */ UV -Perl_to_utf8_fold(pTHX_ U8 *p, U8* ustrp, STRLEN *lenp) +Perl_to_utf8_fold(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp) { return Perl_to_utf8_case(aTHX_ p, ustrp, lenp, &PL_utf8_tofold, "ToFold", "utf8::ToSpecFold"); @@ -1568,13 +1568,13 @@ Perl_to_utf8_fold(pTHX_ U8 *p, U8* ustrp, STRLEN *lenp) /* a "swash" is a swatch hash */ SV* -Perl_swash_init(pTHX_ char* pkg, char* name, SV *listsv, I32 minbits, I32 none) +Perl_swash_init(pTHX_ const char* pkg, const char* name, SV *listsv, I32 minbits, I32 none) { SV* retval; SV* tokenbufsv = sv_newmortal(); dSP; - size_t pkg_len = strlen(pkg); - size_t name_len = strlen(name); + const size_t pkg_len = strlen(pkg); + const size_t name_len = strlen(name); HV *stash = gv_stashpvn(pkg, pkg_len, FALSE); SV* errsv_save; @@ -1641,7 +1641,7 @@ Perl_swash_init(pTHX_ char* pkg, char* name, SV *listsv, I32 minbits, I32 none) * the lower-level routine, and it is similarly broken for returning * multiple values. --jhi */ UV -Perl_swash_fetch(pTHX_ SV *sv, U8 *ptr, bool do_utf8) +Perl_swash_fetch(pTHX_ SV *sv, const U8 *ptr, bool do_utf8) { HV* hv = (HV*)SvRV(sv); U32 klen; @@ -1820,7 +1820,7 @@ Allows length and flags to be passed to low level routine. */ #undef Perl_utf8n_to_uvchr UV -Perl_utf8n_to_uvchr(pTHX_ U8 *s, STRLEN curlen, STRLEN *retlen, U32 flags) +Perl_utf8n_to_uvchr(pTHX_ const U8 *s, STRLEN curlen, STRLEN *retlen, U32 flags) { UV uv = Perl_utf8n_to_uvuni(aTHX_ s, curlen, retlen, flags); return UNI_TO_NATIVE(uv);