diff options
-rw-r--r-- | deb.c | 13 | ||||
-rw-r--r-- | embed.fnc | 1 | ||||
-rw-r--r-- | embed.h | 2 | ||||
-rw-r--r-- | locale.c | 11 | ||||
-rw-r--r-- | pp_sys.c | 201 | ||||
-rw-r--r-- | proto.h | 6 | ||||
-rw-r--r-- | scope.c | 6 | ||||
-rw-r--r-- | universal.c | 12 | ||||
-rw-r--r-- | utf8.c | 2 | ||||
-rw-r--r-- | util.c | 25 |
10 files changed, 126 insertions, 153 deletions
@@ -172,7 +172,7 @@ Perl_deb_stack_all(pTHX) { #ifdef DEBUGGING I32 ix, si_ix; - PERL_SI *si; + const PERL_SI *si; /* rewind to start of chain */ si = PL_curstackinfo; @@ -183,13 +183,13 @@ Perl_deb_stack_all(pTHX) for (;;) { const int si_name_ix = si->si_type+1; /* -1 is a valid index */ - const char *si_name = (si_name_ix>= sizeof(si_names)) ? "????" : si_names[si_name_ix]; + const char * const si_name = (si_name_ix>= sizeof(si_names)) ? "????" : si_names[si_name_ix]; PerlIO_printf(Perl_debug_log, "STACK %"IVdf": %s\n", (IV)si_ix, si_name); for (ix=0; ix<=si->si_cxix; ix++) { - const PERL_CONTEXT *cx = &(si->si_cxstack[ix]); + const PERL_CONTEXT * const cx = &(si->si_cxstack[ix]); PerlIO_printf(Perl_debug_log, " CX %"IVdf": %-6s => ", (IV)ix, PL_block_type[CxTYPE(cx)] @@ -206,9 +206,8 @@ Perl_deb_stack_all(pTHX) */ I32 i, stack_min, stack_max, mark_min, mark_max; - PERL_CONTEXT *cx_n; - PERL_SI *si_n; - OP *retop; + const PERL_CONTEXT *cx_n; + const PERL_SI *si_n; cx_n = Null(PERL_CONTEXT*); @@ -270,7 +269,7 @@ Perl_deb_stack_all(pTHX) if (CxTYPE(cx) == CXt_EVAL || CxTYPE(cx) == CXt_SUB || CxTYPE(cx) == CXt_FORMAT) { - retop = (CxTYPE(cx) == CXt_EVAL) + const OP * const retop = (CxTYPE(cx) == CXt_EVAL) ? cx->blk_eval.retop : cx->blk_sub.retop; PerlIO_printf(Perl_debug_log, " retop=%s\n", @@ -1373,6 +1373,7 @@ sn |NV|mulexp10 |NV value|I32 exponent #if defined(PERL_IN_UTF8_C) || defined(PERL_DECL_PROT) s |STRLEN |is_utf8_char_slow|NN const U8 *s|const STRLEN len +spR |bool |is_utf8_common |NN const U8 *const p|NN SV **swash|NN const char * const swashname #endif START_EXTERN_C @@ -1409,6 +1409,7 @@ #if defined(PERL_IN_UTF8_C) || defined(PERL_DECL_PROT) #ifdef PERL_CORE #define is_utf8_char_slow S_is_utf8_char_slow +#define is_utf8_common S_is_utf8_common #endif #endif #define sv_setsv_flags Perl_sv_setsv_flags @@ -3398,6 +3399,7 @@ #if defined(PERL_IN_UTF8_C) || defined(PERL_DECL_PROT) #ifdef PERL_CORE #define is_utf8_char_slow(a,b) S_is_utf8_char_slow(aTHX_ a,b) +#define is_utf8_common(a,b,c) S_is_utf8_common(aTHX_ a,b,c) #endif #endif #define sv_setsv_flags(a,b,c) Perl_sv_setsv_flags(aTHX_ a,b,c) @@ -53,7 +53,7 @@ STATIC char * S_stdize_locale(pTHX_ char *locs) { - const char *s = strchr(locs, '='); + const char * const s = strchr(locs, '='); bool okay = TRUE; if (s) { @@ -82,9 +82,8 @@ Perl_set_numeric_radix(pTHX) { #ifdef USE_LOCALE_NUMERIC # ifdef HAS_LOCALECONV - struct lconv* lc; + const struct lconv* const lc = localeconv(); - lc = localeconv(); if (lc && lc->decimal_point) { if (lc->decimal_point[0] == '.' && lc->decimal_point[1] == 0) { SvREFCNT_dec(PL_numeric_radix_sv); @@ -254,10 +253,10 @@ Perl_init_i18nl10n(pTHX_ int printwarn) char *curnum = NULL; #endif /* USE_LOCALE_NUMERIC */ #ifdef __GLIBC__ - char *language = PerlEnv_getenv("LANGUAGE"); + char * const language = PerlEnv_getenv("LANGUAGE"); #endif - char *lc_all = PerlEnv_getenv("LC_ALL"); - char *lang = PerlEnv_getenv("LANG"); + char * const lc_all = PerlEnv_getenv("LC_ALL"); + char * const lang = PerlEnv_getenv("LANG"); bool setlocale_failure = FALSE; #ifdef LOCALE_ENVIRON_REQUIRED @@ -330,10 +330,7 @@ PP(pp_backtick) mode = "rt"; fp = PerlProc_popen(tmps, mode); if (fp) { - const char *type = NULL; - if (PL_curcop->cop_io) { - type = SvPV_nolen_const(PL_curcop->cop_io); - } + const char * const type = PL_curcop->cop_io ? SvPV_nolen_const(PL_curcop->cop_io) : NULL; if (type && *type) PerlIO_apply_layers(aTHX_ fp,mode,type); @@ -488,11 +485,11 @@ PP(pp_die) if (!multiarg) SvSetSV(error,tmpsv); else if (sv_isobject(error)) { - HV *stash = SvSTASH(SvRV(error)); - GV *gv = gv_fetchmethod(stash, "PROPAGATE"); + HV * const stash = SvSTASH(SvRV(error)); + GV * const gv = gv_fetchmethod(stash, "PROPAGATE"); if (gv) { - SV *file = sv_2mortal(newSVpv(CopFILE(PL_curcop),0)); - SV *line = sv_2mortal(newSVuv(CopLINE(PL_curcop))); + SV * const file = sv_2mortal(newSVpv(CopFILE(PL_curcop),0)); + SV * const line = sv_2mortal(newSVuv(CopLINE(PL_curcop))); EXTEND(SP, 3); PUSHMARK(SP); PUSHs(error); @@ -880,7 +877,7 @@ PP(pp_untie) if ((mg = SvTIED_mg(sv, how))) { SV * const obj = SvRV(SvTIED_obj(sv, mg)); - CV *cv = NULL; + CV *cv; if (obj) { GV * const gv = gv_fetchmethod_autoload(SvSTASH(obj), "UNTIE", FALSE); if (gv && isGV(gv) && (cv = GvCV(gv))) { @@ -1158,12 +1155,10 @@ Perl_setdefout(pTHX_ GV *gv) PP(pp_select) { dSP; dTARGET; - GV *egv; HV *hv; - GV * const newdefout = (PL_op->op_private > 0) ? ((GV *) POPs) : (GV *) NULL; + GV * egv = GvEGV(PL_defoutgv); - egv = GvEGV(PL_defoutgv); if (!egv) egv = PL_defoutgv; hv = GvSTASH(egv); @@ -1775,7 +1770,6 @@ PP(pp_sysread) PP(pp_send) { dVAR; dSP; dMARK; dORIGMARK; dTARGET; - GV *gv; IO *io; SV *bufsv; const char *buffer; @@ -1785,7 +1779,7 @@ PP(pp_send) MAGIC *mg; const int op_type = PL_op->op_type; - gv = (GV*)*++MARK; + GV *const gv = (GV*)*++MARK; if (PL_op->op_type == OP_SYSWRITE && gv && (io = GvIO(gv)) && (mg = SvTIED_mg((SV*)io, PERL_MAGIC_tiedscalar))) @@ -2009,17 +2003,16 @@ PP(pp_tell) PP(pp_sysseek) { dVAR; dSP; - GV *gv; IO *io; const int whence = POPi; #if LSEEKSIZE > IVSIZE - Off_t offset = (Off_t)SvNVx(POPs); + const Off_t offset = (Off_t)SvNVx(POPs); #else - Off_t offset = (Off_t)SvIVx(POPs); + const Off_t offset = (Off_t)SvIVx(POPs); #endif MAGIC *mg; - gv = PL_last_in_gv = (GV*)POPs; + GV * const gv = PL_last_in_gv = (GV*)POPs; if (gv && (io = GvIO(gv)) && (mg = SvTIED_mg((SV*)io, PERL_MAGIC_tiedscalar))) @@ -2047,7 +2040,7 @@ PP(pp_sysseek) if (sought < 0) PUSHs(&PL_sv_undef); else { - SV* sv = sought ? + SV* const sv = sought ? #if LSEEKSIZE > IVSIZE newSVnv((NV)sought) #else @@ -2068,12 +2061,11 @@ PP(pp_truncate) * general one would think that when using large files, off_t is * at least as wide as size_t, so using an off_t should be okay. */ /* XXX Configure probe for the length type of *truncate() needed XXX */ - Off_t len; #if Off_t_size > IVSIZE - len = (Off_t)POPn; + const Off_t len = (Off_t)POPn; #else - len = (Off_t)POPi; + const Off_t len = (Off_t)POPi; #endif /* Checking for length < 0 is problematic as the type might or * might not be signed: if it is not, clever compilers will moan. */ @@ -2110,7 +2102,7 @@ PP(pp_truncate) } } else { - SV *sv = POPs; + SV * const sv = POPs; const char *name; if (SvTYPE(sv) == SVt_PVGV) { @@ -2133,9 +2125,9 @@ PP(pp_truncate) result = 0; #else { - int tmpfd; + const int tmpfd = PerlLIO_open(name, O_RDWR); - if ((tmpfd = PerlLIO_open(name, O_RDWR)) < 0) + if (tmpfd < 0) result = 0; else { if (my_chsize(tmpfd, len) < 0) @@ -2157,13 +2149,13 @@ PP(pp_truncate) PP(pp_ioctl) { dSP; dTARGET; - SV *argsv = POPs; + SV * const argsv = POPs; const unsigned int func = POPu; const int optype = PL_op->op_type; + GV * const gv = (GV*)POPs; + IO * const io = gv ? GvIOn(gv) : Null(IO*); char *s; IV retval; - GV *gv = (GV*)POPs; - IO *io = gv ? GvIOn(gv) : 0; if (!io || !argsv || !IoIFP(io)) { if (ckWARN2(WARN_UNOPENED,WARN_CLOSED)) @@ -2234,16 +2226,11 @@ PP(pp_flock) #ifdef FLOCK dSP; dTARGET; I32 value; - int argtype; - GV *gv; IO *io = NULL; PerlIO *fp; + const int argtype = POPi; + GV * const gv = (MAXARG == 0) ? PL_last_in_gv : (GV*)POPs; - argtype = POPi; - if (MAXARG == 0) - gv = PL_last_in_gv; - else - gv = (GV*)POPs; if (gv && (io = GvIO(gv))) fp = IoIFP(io); else { @@ -2273,16 +2260,13 @@ PP(pp_socket) { #ifdef HAS_SOCKET dSP; - GV *gv; - register IO *io; - int protocol = POPi; - int type = POPi; - int domain = POPi; + const int protocol = POPi; + const int type = POPi; + const int domain = POPi; + GV * const gv = (GV*)POPs; + register IO * const io = gv ? GvIOn(gv) : NULL; int fd; - gv = (GV*)POPs; - io = gv ? GvIOn(gv) : NULL; - if (!gv || !io) { if (ckWARN2(WARN_UNOPENED,WARN_CLOSED)) report_evil_fh(gv, io, PL_op->op_type); @@ -2326,19 +2310,15 @@ PP(pp_sockpair) { #if defined (HAS_SOCKETPAIR) || (defined (HAS_SOCKET) && defined(SOCK_DGRAM) && defined(AF_INET) && defined(PF_INET)) dSP; - GV *gv1; - GV *gv2; - register IO *io1; - register IO *io2; - int protocol = POPi; - int type = POPi; - int domain = POPi; + const int protocol = POPi; + const int type = POPi; + const int domain = POPi; + GV * const gv2 = (GV*)POPs; + GV * const gv1 = (GV*)POPs; + register IO * const io1 = gv1 ? GvIOn(gv1) : NULL; + register IO * const io2 = gv2 ? GvIOn(gv2) : NULL; int fd[2]; - gv2 = (GV*)POPs; - gv1 = (GV*)POPs; - io1 = gv1 ? GvIOn(gv1) : NULL; - io2 = gv2 ? GvIOn(gv2) : NULL; if (!gv1 || !gv2 || !io1 || !io2) { if (ckWARN2(WARN_UNOPENED,WARN_CLOSED)) { if (!gv1 || !io1) @@ -2395,11 +2375,11 @@ PP(pp_bind) extern void GETPRIVMODE(); extern void GETUSERMODE(); #endif - SV *addrsv = POPs; + SV * const addrsv = POPs; /* OK, so on what platform does bind modify addr? */ const char *addr; - GV *gv = (GV*)POPs; - register IO *io = GvIOn(gv); + GV * const gv = (GV*)POPs; + register IO * const io = GvIOn(gv); STRLEN len; int bind_ok = 0; #ifdef MPE @@ -2451,10 +2431,10 @@ PP(pp_connect) { #ifdef HAS_SOCKET dSP; - SV *addrsv = POPs; + SV * const addrsv = POPs; + GV * const gv = (GV*)POPs; + register IO * const io = GvIOn(gv); const char *addr; - GV *gv = (GV*)POPs; - register IO *io = GvIOn(gv); STRLEN len; if (!io || !IoIFP(io)) @@ -2481,9 +2461,9 @@ PP(pp_listen) { #ifdef HAS_SOCKET dSP; - int backlog = POPi; - GV *gv = (GV*)POPs; - register IO *io = gv ? GvIOn(gv) : NULL; + const int backlog = POPi; + GV * const gv = (GV*)POPs; + register IO * const io = gv ? GvIOn(gv) : NULL; if (!gv || !io || !IoIFP(io)) goto nuts; @@ -2507,8 +2487,6 @@ PP(pp_accept) { #ifdef HAS_SOCKET dSP; dTARGET; - GV *ngv; - GV *ggv; register IO *nstio; register IO *gstio; char namebuf[MAXPATHLEN]; @@ -2517,11 +2495,10 @@ PP(pp_accept) #else Sock_size_t len = sizeof namebuf; #endif + GV * const ggv = (GV*)POPs; + GV * const ngv = (GV*)POPs; int fd; - ggv = (GV*)POPs; - ngv = (GV*)POPs; - if (!ngv) goto badexit; if (!ggv) @@ -2578,9 +2555,9 @@ PP(pp_shutdown) { #ifdef HAS_SOCKET dSP; dTARGET; - int how = POPi; - GV *gv = (GV*)POPs; - register IO *io = GvIOn(gv); + const int how = POPi; + GV * const gv = (GV*)POPs; + register IO * const io = GvIOn(gv); if (!io || !IoIFP(io)) goto nuts; @@ -2602,24 +2579,15 @@ PP(pp_ssockopt) { #ifdef HAS_SOCKET dSP; - int optype = PL_op->op_type; - SV *sv; + const int optype = PL_op->op_type; + SV * const sv = (optype == OP_GSOCKOPT) ? sv_2mortal(NEWSV(22, 257)) : POPs; + const unsigned int optname = (unsigned int) POPi; + const unsigned int lvl = (unsigned int) POPi; + GV * const gv = (GV*)POPs; + register IO * const io = GvIOn(gv); int fd; - unsigned int optname; - unsigned int lvl; - GV *gv; - register IO *io; Sock_size_t len; - if (optype == OP_GSOCKOPT) - sv = sv_2mortal(NEWSV(22, 257)); - else - sv = POPs; - optname = (unsigned int) POPi; - lvl = (unsigned int) POPi; - - gv = (GV*)POPs; - io = GvIOn(gv); if (!io || !IoIFP(io)) goto nuts; @@ -2688,12 +2656,12 @@ PP(pp_getpeername) { #ifdef HAS_SOCKET dSP; - int optype = PL_op->op_type; + const int optype = PL_op->op_type; + GV * const gv = (GV*)POPs; + register IO * const io = GvIOn(gv); + Sock_size_t len; SV *sv; int fd; - GV *gv = (GV*)POPs; - register IO *io = GvIOn(gv); - Sock_size_t len; if (!io || !IoIFP(io)) goto nuts; @@ -2784,7 +2752,7 @@ PP(pp_stat) } } else { - SV* sv = POPs; + SV* const sv = POPs; if (SvTYPE(sv) == SVt_PVGV) { gv = (GV*)sv; goto do_fstat; @@ -3414,7 +3382,7 @@ PP(pp_chroot) { #ifdef HAS_CHROOT dSP; dTARGET; - char *tmps = POPpx; + char * const tmps = POPpx; TAINT_PROPER("chroot"); PUSHi( chroot(tmps) >= 0 ); RETURN; @@ -3427,8 +3395,8 @@ PP(pp_rename) { dSP; dTARGET; int anum; - const char *tmps2 = POPpconstx; - const char *tmps = SvPV_nolen_const(TOPs); + const char * const tmps2 = POPpconstx; + const char * const tmps = SvPV_nolen_const(TOPs); TAINT_PROPER("rename"); #ifdef HAS_RENAME anum = PerlLIO_rename(tmps, tmps2); @@ -3465,8 +3433,8 @@ PP(pp_link) # endif { - const char *tmps2 = POPpconstx; - const char *tmps = SvPV_nolen_const(TOPs); + const char * const tmps2 = POPpconstx; + const char * const tmps = SvPV_nolen_const(TOPs); TAINT_PROPER(PL_op_desc[op_type]); result = # if defined(HAS_LINK) @@ -3632,18 +3600,13 @@ S_dooneliner(pTHX_ const char *cmd, const char *filename) PP(pp_mkdir) { dSP; dTARGET; - int mode; #ifndef HAS_MKDIR int oldumask; #endif STRLEN len; const char *tmps; bool copy = FALSE; - - if (MAXARG > 1) - mode = POPi; - else - mode = 0777; + const int mode = (MAXARG > 1) ? POPi : 0777; TRIMSLASHES(tmps,len,copy); @@ -3686,9 +3649,9 @@ PP(pp_open_dir) { #if defined(Direntry_t) && defined(HAS_READDIR) dSP; - const char *dirname = POPpconstx; - GV *gv = (GV*)POPs; - register IO *io = GvIOn(gv); + const char * const dirname = POPpconstx; + GV * const gv = (GV*)POPs; + register IO * const io = GvIOn(gv); if (!io) goto nope; @@ -3720,9 +3683,9 @@ PP(pp_readdir) SV *sv; const I32 gimme = GIMME; - GV *gv = (GV *)POPs; - register Direntry_t *dp; - register IO *io = GvIOn(gv); + GV * const gv = (GV *)POPs; + register const Direntry_t *dp; + register IO * const io = GvIOn(gv); if (!io || !IoDIRP(io)) goto nope; @@ -3770,8 +3733,8 @@ PP(pp_telldir) # if !defined(HAS_TELLDIR_PROTO) || defined(NEED_TELLDIR_PROTO) long telldir (DIR *); # endif - GV *gv = (GV*)POPs; - register IO *io = GvIOn(gv); + GV * const gv = (GV*)POPs; + register IO * const io = GvIOn(gv); if (!io || !IoDIRP(io)) goto nope; @@ -3791,9 +3754,9 @@ PP(pp_seekdir) { #if defined(HAS_SEEKDIR) || defined(seekdir) dSP; - long along = POPl; - GV *gv = (GV*)POPs; - register IO *io = GvIOn(gv); + const long along = POPl; + GV * const gv = (GV*)POPs; + register IO * const io = GvIOn(gv); if (!io || !IoDIRP(io)) goto nope; @@ -3814,8 +3777,8 @@ PP(pp_rewinddir) { #if defined(HAS_REWINDDIR) || defined(rewinddir) dSP; - GV *gv = (GV*)POPs; - register IO *io = GvIOn(gv); + GV * const gv = (GV*)POPs; + register IO * const io = GvIOn(gv); if (!io || !IoDIRP(io)) goto nope; @@ -3835,8 +3798,8 @@ PP(pp_closedir) { #if defined(Direntry_t) && defined(HAS_READDIR) dSP; - GV *gv = (GV*)POPs; - register IO *io = GvIOn(gv); + GV * const gv = (GV*)POPs; + register IO * const io = GvIOn(gv); if (!io || !IoDIRP(io)) goto nope; @@ -3868,7 +3831,6 @@ PP(pp_fork) #ifdef HAS_FORK dSP; dTARGET; Pid_t childpid; - GV *tmpgv; EXTEND(SP, 1); PERL_FLUSHALL_FOR_CHILD; @@ -3876,7 +3838,8 @@ PP(pp_fork) if (childpid < 0) RETSETUNDEF; if (!childpid) { - if ((tmpgv = gv_fetchpv("$", TRUE, SVt_PV))) { + GV * const tmpgv = gv_fetchpv("$", TRUE, SVt_PV); + if (tmpgv) { SvREADONLY_off(GvSV(tmpgv)); sv_setiv(GvSV(tmpgv), (IV)PerlProc_getpid()); SvREADONLY_on(GvSV(tmpgv)); @@ -3762,6 +3762,12 @@ STATIC NV S_mulexp10(NV value, I32 exponent); STATIC STRLEN S_is_utf8_char_slow(pTHX_ const U8 *s, const STRLEN len) __attribute__nonnull__(pTHX_1); +STATIC bool S_is_utf8_common(pTHX_ const U8 *const p, SV **swash, const char * const swashname) + __attribute__warn_unused_result__ + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2) + __attribute__nonnull__(pTHX_3); + #endif START_EXTERN_C @@ -169,7 +169,7 @@ S_save_scalar_at(pTHX_ SV **sptr) SV * Perl_save_scalar(pTHX_ GV *gv) { - SV **sptr = &GvSV(gv); + SV ** const sptr = &GvSV(gv); PL_localizing = 1; SvGETMAGIC(*sptr); PL_localizing = 0; @@ -963,8 +963,8 @@ Perl_leave_scope(pTHX_ I32 base) case SAVEt_SAVESWITCHSTACK: { dSP; - AV* t = (AV*)SSPOPPTR; - AV* f = (AV*)SSPOPPTR; + AV* const t = (AV*)SSPOPPTR; + AV* const f = (AV*)SSPOPPTR; SWITCHSTACK(t,f); PL_curstackinfo->si_stack = f; } diff --git a/universal.c b/universal.c index f8fa9cda88..1f63563da6 100644 --- a/universal.c +++ b/universal.c @@ -66,7 +66,7 @@ S_isa_lookup(pTHX_ HV *stash, const char *name, HV* name_stash, { if (SvIV(subgen) == (IV)PL_sub_generation) { SV* sv; - SV** svp = (SV**)hv_fetch(hv, name, len, FALSE); + SV** const svp = (SV**)hv_fetch(hv, name, len, FALSE); if (svp && (sv = *svp) != (SV*)&PL_sv_undef) { DEBUG_o( Perl_deb(aTHX_ "Using cached ISA %s for package %s\n", name, hvname) ); @@ -435,7 +435,7 @@ XS(XS_version_stringify) Perl_croak(aTHX_ "Usage: version::stringify(lobj, ...)"); SP -= items; { - SV * lobj = Nullsv; + SV * lobj; if (sv_derived_from(ST(0), "version")) { lobj = SvRV(ST(0)); @@ -457,7 +457,7 @@ XS(XS_version_numify) Perl_croak(aTHX_ "Usage: version::numify(lobj, ...)"); SP -= items; { - SV * lobj = Nullsv; + SV * lobj; if (sv_derived_from(ST(0), "version")) { lobj = SvRV(ST(0)); @@ -479,7 +479,7 @@ XS(XS_version_normal) Perl_croak(aTHX_ "Usage: version::normal(lobj, ...)"); SP -= items; { - SV * lobj = Nullsv; + SV * lobj; if (sv_derived_from(ST(0), "version")) { lobj = SvRV(ST(0)); @@ -501,7 +501,7 @@ XS(XS_version_vcmp) Perl_croak(aTHX_ "Usage: version::vcmp(lobj, ...)"); SP -= items; { - SV * lobj = Nullsv; + SV * lobj; if (sv_derived_from(ST(0), "version")) { lobj = SvRV(ST(0)); @@ -513,7 +513,7 @@ XS(XS_version_vcmp) SV *rs; SV *rvs; SV * robj = ST(1); - IV swap = (IV)SvIV(ST(2)); + const IV swap = (IV)SvIV(ST(2)); if ( ! sv_derived_from(robj, "version") ) { @@ -1236,7 +1236,7 @@ Perl_to_uni_lower_lc(pTHX_ U32 c) return (U32)to_uni_lower(c, tmpbuf, &len); } -bool +static bool S_is_utf8_common(pTHX_ const U8 *const p, SV **swash, const char *const swashname) { @@ -291,7 +291,7 @@ char * Perl_ninstr(pTHX_ register const char *big, register const char *bigend, const char *little, const char *lend) { register const I32 first = *little; - register const char *littleend = lend; + register const char * const littleend = lend; if (!first && little >= littleend) return (char*)big; @@ -321,7 +321,7 @@ Perl_rninstr(pTHX_ register const char *big, const char *bigend, const char *lit { register const char *bigbeg; register const I32 first = *little; - register const char *littleend = lend; + register const char * const littleend = lend; if (!first && little >= littleend) return (char*)bigend; @@ -839,7 +839,7 @@ char * Perl_savesvpv(pTHX_ SV *sv) { STRLEN len; - const char *pv = SvPV_const(sv, len); + const char * const pv = SvPV_const(sv, len); register char *newaddr; ++len; @@ -1358,7 +1358,7 @@ Perl_vwarner(pTHX_ U32 err, const char* pat, va_list* args) if (ckDEAD(err)) { SV * const msv = vmess(pat, args); STRLEN msglen; - const char *message = SvPV_const(msv, msglen); + const char * const message = SvPV_const(msv, msglen); const I32 utf8 = SvUTF8(msv); if (PL_diehook) { @@ -2739,7 +2739,7 @@ Perl_my_pclose(pTHX_ PerlIO *ptr) { /* Needs work for PerlIO ! */ FILE * const f = PerlIO_findFILE(ptr); - I32 result = pclose(f); + const I32 result = pclose(f); PerlIO_releaseFILE(ptr,f); return result; } @@ -3147,7 +3147,7 @@ Perl_getenv_len(pTHX_ const char *env_elem, unsigned long *len) MGVTBL* Perl_get_vtbl(pTHX_ int vtbl_id) { - const MGVTBL* result = Null(MGVTBL*); + const MGVTBL* result; switch(vtbl_id) { case want_vtbl_sv: @@ -3242,6 +3242,9 @@ Perl_get_vtbl(pTHX_ int vtbl_id) case want_vtbl_utf8: result = &PL_vtbl_utf8; break; + default: + result = Null(MGVTBL*); + break; } return (MGVTBL*)result; } @@ -3916,8 +3919,8 @@ Perl_scan_version(pTHX_ const char *s, SV *rv, bool qv) int saw_period = 0; int alpha = 0; int width = 3; - AV *av = newAV(); - SV *hv = newSVrv(rv, "version"); /* create an SV and upgrade the RV */ + AV * const av = newAV(); + SV * const hv = newSVrv(rv, "version"); /* create an SV and upgrade the RV */ (void)sv_upgrade(hv, SVt_PVHV); /* needs to be an HV type */ #ifndef NODEFAULT_SHAREKEYS @@ -4705,7 +4708,7 @@ Perl_my_socketpair (int family, int type, int protocol, int fd[2]) { #endif tidy_up_and_fail: { - int save_errno = errno; + const int save_errno = errno; if (listener != -1) PerlLIO_close(listener); if (connector != -1) @@ -4945,8 +4948,8 @@ Perl_init_global_struct(pTHX) #ifdef PERL_GLOBAL_STRUCT # define PERL_GLOBAL_STRUCT_INIT # include "opcode.h" /* the ppaddr and check */ - IV nppaddr = sizeof(Gppaddr)/sizeof(Perl_ppaddr_t); - IV ncheck = sizeof(Gcheck) /sizeof(Perl_check_t); + const IV nppaddr = sizeof(Gppaddr)/sizeof(Perl_ppaddr_t); + const IV ncheck = sizeof(Gcheck) /sizeof(Perl_check_t); # ifdef PERL_GLOBAL_STRUCT_PRIVATE /* PerlMem_malloc() because can't use even safesysmalloc() this early. */ plvarsp = (struct perl_vars*)PerlMem_malloc(sizeof(struct perl_vars)); |