From: Andy Lester Date: Fri, 25 Mar 2005 14:43:31 +0000 (-0600) Subject: Consting part 4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=73d840c0daa603a18a29260159881d4ef6772d73;p=p5sagit%2Fp5-mst-13.2.git Consting part 4 Message-ID: <20050325204331.GA16388@petdance.com> p4raw-id: //depot/perl@24079 --- diff --git a/embed.fnc b/embed.fnc index 4904dc9..4faf632 100644 --- a/embed.fnc +++ b/embed.fnc @@ -400,7 +400,7 @@ p |U32 |magic_len |SV* sv|MAGIC* mg p |int |magic_nextpack |SV* sv|MAGIC* mg|SV* key p |U32 |magic_regdata_cnt|SV* sv|MAGIC* mg p |int |magic_regdatum_get|SV* sv|MAGIC* mg -p |int |magic_regdatum_set|SV* sv|MAGIC* mg +pr |int |magic_regdatum_set|SV* sv|MAGIC* mg p |int |magic_set |SV* sv|MAGIC* mg p |int |magic_setamagic|SV* sv|MAGIC* mg p |int |magic_setarylen|SV* sv|MAGIC* mg @@ -549,7 +549,7 @@ Apd |int |vcmp |SV *lvs|SV *rvs p |PerlIO*|nextargv |GV* gv Ap |char* |ninstr |const char* big|const char* bigend \ |const char* little|const char* lend -p |OP* |oopsCV |OP* o +pr |OP* |oopsCV |OP* o Ap |void |op_free |OP* arg p |void |package |OP* o pd |PADOFFSET|pad_alloc |I32 optype|U32 tmptype @@ -655,7 +655,7 @@ Ap |void |save_shared_pvref|char** str Ap |void |save_gp |GV* gv|I32 empty Ap |HV* |save_hash |GV* gv Ap |void |save_helem |HV* hv|SV *key|SV **sptr -Ap |void |save_hints +Apr |void |save_hints Ap |void |save_hptr |HV** hptr Ap |void |save_I16 |I16* intp Ap |void |save_I32 |I32* intp @@ -675,16 +675,16 @@ Ap |void |save_re_context Ap |void |save_padsv |PADOFFSET off Ap |void |save_sptr |SV** sptr Ap |SV* |save_svref |SV** sptr -Ap |SV** |save_threadsv |PADOFFSET i +Apr |SV** |save_threadsv |PADOFFSET i p |OP* |sawparens |OP* o p |OP* |scalar |OP* o p |OP* |scalarkids |OP* o p |OP* |scalarseq |OP* o p |OP* |scalarvoid |OP* o -Apd |NV |scan_bin |char* start|STRLEN len|STRLEN* retlen -Apd |NV |scan_hex |char* start|STRLEN len|STRLEN* retlen +Apd |NV |scan_bin |const char* start|STRLEN len|STRLEN* retlen +Apd |NV |scan_hex |const char* start|STRLEN len|STRLEN* retlen Ap |char* |scan_num |const char* s|YYSTYPE *lvalp -Apd |NV |scan_oct |char* start|STRLEN len|STRLEN* retlen +Apd |NV |scan_oct |const char* start|STRLEN len|STRLEN* retlen p |OP* |scope |OP* o Ap |char* |screaminstr |SV* bigsv|SV* littlesv|I32 start_shift \ |I32 end_shift|I32 *state|I32 last @@ -920,7 +920,7 @@ Apd |SV* |sv_rvweaken |SV *sv p |int |magic_killbackrefs|SV *sv|MAGIC *mg Ap |OP* |newANONATTRSUB |I32 floor|OP *proto|OP *attrs|OP *block Ap |CV* |newATTRSUB |I32 floor|OP *o|OP *proto|OP *attrs|OP *block -Ap |void |newMYSUB |I32 floor|OP *o|OP *proto|OP *attrs|OP *block +Apr |void |newMYSUB |I32 floor|OP *o|OP *proto|OP *attrs|OP *block p |OP * |my_attrs |OP *o|OP *attrs p |void |boot_core_xsutils #if defined(USE_ITHREADS) @@ -989,7 +989,7 @@ s |HEK* |save_hek_flags |const char *str|I32 len|U32 hash|int flags s |void |hv_magic_check |HV *hv|bool *needs_copy|bool *needs_store s |void |unshare_hek_or_pvn|HEK* hek|const char* sv|I32 len|U32 hash s |HEK* |share_hek_flags|const char* sv|I32 len|U32 hash|int flags -s |void |hv_notallowed |int flags|const char *key|I32 klen|const char *msg +rs |void |hv_notallowed |int flags|const char *key|I32 klen|const char *msg #endif #if defined(PERL_IN_MG_C) || defined(PERL_DECL_PROT) @@ -1130,7 +1130,7 @@ Es |I32 |study_chunk |struct RExC_state_t*|regnode **scanp|I32 *deltap \ |regnode *last|struct scan_data_t *data \ |U32 flags|U32 depth Es |I32 |add_data |struct RExC_state_t*|I32 n|const char *s -rs |void|re_croak2 |const char* pat1|const char* pat2|... +rs |void |re_croak2 |const char* pat1|const char* pat2|... Es |I32 |regpposixcc |struct RExC_state_t*|I32 value Es |void |checkposixcc |struct RExC_state_t* @@ -1259,7 +1259,7 @@ s |void |incline |char *s s |int |intuit_method |char *s|GV *gv s |int |intuit_more |char *s s |I32 |lop |I32 f|int x|char *s -s |void |missingterm |char *s +rs |void |missingterm |char *s s |void |no_op |const char *what|char *s s |void |set_csh s |I32 |sublex_done diff --git a/mg.c b/mg.c index 679c51e..db1175f 100644 --- a/mg.c +++ b/mg.c @@ -476,6 +476,7 @@ Perl_magic_regdatum_set(pTHX_ SV *sv, MAGIC *mg) { Perl_croak(aTHX_ PL_no_modify); /* NOT REACHED */ + (void)sv; (void)mg; return 0; } diff --git a/numeric.c b/numeric.c index a6386e8..aeb1a02 100644 --- a/numeric.c +++ b/numeric.c @@ -471,33 +471,33 @@ For backwards compatibility. Use C instead. */ NV -Perl_scan_bin(pTHX_ char *start, STRLEN len, STRLEN *retlen) +Perl_scan_bin(pTHX_ const char *start, STRLEN len, STRLEN *retlen) { NV rnv; I32 flags = *retlen ? PERL_SCAN_ALLOW_UNDERSCORES : 0; - UV ruv = grok_bin (start, &len, &flags, &rnv); + const UV ruv = grok_bin (start, &len, &flags, &rnv); *retlen = len; return (flags & PERL_SCAN_GREATER_THAN_UV_MAX) ? rnv : (NV)ruv; } NV -Perl_scan_oct(pTHX_ char *start, STRLEN len, STRLEN *retlen) +Perl_scan_oct(pTHX_ const char *start, STRLEN len, STRLEN *retlen) { NV rnv; I32 flags = *retlen ? PERL_SCAN_ALLOW_UNDERSCORES : 0; - UV ruv = grok_oct (start, &len, &flags, &rnv); + const UV ruv = grok_oct (start, &len, &flags, &rnv); *retlen = len; return (flags & PERL_SCAN_GREATER_THAN_UV_MAX) ? rnv : (NV)ruv; } NV -Perl_scan_hex(pTHX_ char *start, STRLEN len, STRLEN *retlen) +Perl_scan_hex(pTHX_ const char *start, STRLEN len, STRLEN *retlen) { NV rnv; I32 flags = *retlen ? PERL_SCAN_ALLOW_UNDERSCORES : 0; - UV ruv = grok_hex (start, &len, &flags, &rnv); + const UV ruv = grok_hex (start, &len, &flags, &rnv); *retlen = len; return (flags & PERL_SCAN_GREATER_THAN_UV_MAX) ? rnv : (NV)ruv; @@ -516,7 +516,7 @@ Perl_grok_numeric_radix(pTHX_ const char **sp, const char *send) #ifdef USE_LOCALE_NUMERIC if (PL_numeric_radix_sv && IN_LOCALE) { STRLEN len; - char* radix = SvPV(PL_numeric_radix_sv, len); + const char* radix = SvPV(PL_numeric_radix_sv, len); if (*sp + len <= send && memEQ(*sp, radix, len)) { *sp += len; return TRUE; @@ -998,7 +998,7 @@ Perl_my_atof2(pTHX_ const char* orig, NV* value) result[2] = -result[2]; #endif /* USE_PERL_ATOF */ *value = result[2]; - return s; + return (char *)s; } #if ! defined(HAS_MODFL) && defined(HAS_AINTL) && defined(HAS_COPYSIGNL) diff --git a/op.c b/op.c index 9fa2176..a1542f3 100644 --- a/op.c +++ b/op.c @@ -1851,7 +1851,7 @@ Perl_save_hints(pTHX) int Perl_block_start(pTHX_ int full) { - int retval = PL_savestack_ix; + const int retval = PL_savestack_ix; pad_block_start(full); SAVEHINTS(); PL_hints &= ~HINT_BLOCK_SCOPE; @@ -3699,8 +3699,9 @@ Perl_newLOOPOP(pTHX_ I32 flags, I32 debuggable, OP *expr, OP *block) { OP* listop; OP* o; - int once = block && block->op_flags & OPf_SPECIAL && + const bool once = block && block->op_flags & OPf_SPECIAL && (block->op_type == OP_ENTERSUB || block->op_type == OP_NULL); + (void)debuggable; if (expr) { if (once && expr->op_type == OP_CONST && !SvTRUE(((SVOP*)expr)->op_sv)) @@ -3710,8 +3711,8 @@ Perl_newLOOPOP(pTHX_ I32 flags, I32 debuggable, OP *expr, OP *block) expr = newUNOP(OP_DEFINED, 0, newASSIGNOP(0, newDEFSVOP(), 0, expr) ); } else if (expr->op_flags & OPf_KIDS) { - OP *k1 = ((UNOP*)expr)->op_first; - OP *k2 = (k1) ? k1->op_sibling : NULL; + const OP *k1 = ((UNOP*)expr)->op_first; + const OP *k2 = (k1) ? k1->op_sibling : NULL; switch (expr->op_type) { case OP_NULL: if (k2 && k2->op_type == OP_READLINE @@ -3761,6 +3762,7 @@ Perl_newWHILEOP(pTHX_ I32 flags, I32 debuggable, LOOP *loop, I32 whileline, OP * OP *listop; OP *o; U8 loopflags = 0; + (void)debuggable; if (expr && (expr->op_type == OP_READLINE || expr->op_type == OP_GLOB || (expr->op_type == OP_NULL && expr->op_targ == OP_GLOB))) { @@ -3879,7 +3881,7 @@ Perl_newFOROP(pTHX_ I32 flags,char *label,line_t forline,OP *sv,OP *expr,OP *blo Perl_croak(aTHX_ "Can't use %s for loop variable", PL_op_desc[sv->op_type]); } else { - I32 offset = pad_findmy("$_"); + const I32 offset = pad_findmy("$_"); if (offset == NOT_IN_PAD || PAD_COMPNAME_FLAGS(offset) & SVpad_OUR) { sv = newGVOP(OP_GV, 0, PL_defgv); } @@ -4158,6 +4160,7 @@ Perl_op_const_sv(pTHX_ OP *o, CV *cv) void Perl_newMYSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block) { + (void)floor; if (o) SAVEFREEOP(o); if (proto) @@ -4842,7 +4845,7 @@ Perl_oopsCV(pTHX_ OP *o) { Perl_croak(aTHX_ "NOT IMPL LINE %d",__LINE__); /* STUB */ - return o; + (void)o; } OP * diff --git a/perlio.c b/perlio.c index 2f5373c..4d2b6a9 100644 --- a/perlio.c +++ b/perlio.c @@ -4727,8 +4727,8 @@ char * PerlIO_getname(PerlIO *f, char *buf) { dTHX; - char *name = NULL; #ifdef VMS + char *name = NULL; bool exported = FALSE; FILE *stdio = PerlIOSelf(f, PerlIOStdio)->stdio; if (!stdio) { @@ -4739,10 +4739,12 @@ PerlIO_getname(PerlIO *f, char *buf) name = fgetname(stdio, buf); if (exported) PerlIO_releaseFILE(f,stdio); } + return name; #else + (void)f; + (void)buf; Perl_croak(aTHX_ "Don't know how to get file name"); #endif - return name; } diff --git a/pod/perlapi.pod b/pod/perlapi.pod index a915892..a724f3e 100644 --- a/pod/perlapi.pod +++ b/pod/perlapi.pod @@ -2139,7 +2139,7 @@ Found in file numeric.c For backwards compatibility. Use C instead. - NV scan_bin(char* start, STRLEN len, STRLEN* retlen) + NV scan_bin(const char* start, STRLEN len, STRLEN* retlen) =for hackers Found in file numeric.c @@ -2148,7 +2148,7 @@ Found in file numeric.c For backwards compatibility. Use C instead. - NV scan_hex(char* start, STRLEN len, STRLEN* retlen) + NV scan_hex(const char* start, STRLEN len, STRLEN* retlen) =for hackers Found in file numeric.c @@ -2157,7 +2157,7 @@ Found in file numeric.c For backwards compatibility. Use C instead. - NV scan_oct(char* start, STRLEN len, STRLEN* retlen) + NV scan_oct(const char* start, STRLEN len, STRLEN* retlen) =for hackers Found in file numeric.c @@ -5097,6 +5097,8 @@ missing (NULL). When running with taint checks enabled, indicates via C if results are untrustworthy (often due to the use of locales). +XXX Except that it maybe_tainted is never assigned to. + Usually used via one of its frontends C and C. void sv_vcatpvfn(SV* sv, const char* pat, STRLEN patlen, va_list* args, SV** svargs, I32 svmax, bool *maybe_tainted) diff --git a/proto.h b/proto.h index a40c23e..6a7564f 100644 --- a/proto.h +++ b/proto.h @@ -377,7 +377,7 @@ PERL_CALLCONV U32 Perl_magic_len(pTHX_ SV* sv, MAGIC* mg); PERL_CALLCONV int Perl_magic_nextpack(pTHX_ SV* sv, MAGIC* mg, SV* key); PERL_CALLCONV U32 Perl_magic_regdata_cnt(pTHX_ SV* sv, MAGIC* mg); PERL_CALLCONV int Perl_magic_regdatum_get(pTHX_ SV* sv, MAGIC* mg); -PERL_CALLCONV int Perl_magic_regdatum_set(pTHX_ SV* sv, MAGIC* mg); +PERL_CALLCONV int Perl_magic_regdatum_set(pTHX_ SV* sv, MAGIC* mg) __attribute__((noreturn)); PERL_CALLCONV int Perl_magic_set(pTHX_ SV* sv, MAGIC* mg); PERL_CALLCONV int Perl_magic_setamagic(pTHX_ SV* sv, MAGIC* mg); PERL_CALLCONV int Perl_magic_setarylen(pTHX_ SV* sv, MAGIC* mg); @@ -525,7 +525,7 @@ PERL_CALLCONV SV* Perl_vstringify(pTHX_ SV *vs); PERL_CALLCONV int Perl_vcmp(pTHX_ SV *lvs, SV *rvs); PERL_CALLCONV PerlIO* Perl_nextargv(pTHX_ GV* gv); PERL_CALLCONV char* Perl_ninstr(pTHX_ const char* big, const char* bigend, const char* little, const char* lend); -PERL_CALLCONV OP* Perl_oopsCV(pTHX_ OP* o); +PERL_CALLCONV OP* Perl_oopsCV(pTHX_ OP* o) __attribute__((noreturn)); PERL_CALLCONV void Perl_op_free(pTHX_ OP* arg); PERL_CALLCONV void Perl_package(pTHX_ OP* o); PERL_CALLCONV PADOFFSET Perl_pad_alloc(pTHX_ I32 optype, U32 tmptype); @@ -624,7 +624,7 @@ PERL_CALLCONV void Perl_save_shared_pvref(pTHX_ char** str); PERL_CALLCONV void Perl_save_gp(pTHX_ GV* gv, I32 empty); PERL_CALLCONV HV* Perl_save_hash(pTHX_ GV* gv); PERL_CALLCONV void Perl_save_helem(pTHX_ HV* hv, SV *key, SV **sptr); -PERL_CALLCONV void Perl_save_hints(pTHX); +PERL_CALLCONV void Perl_save_hints(pTHX) __attribute__((noreturn)); PERL_CALLCONV void Perl_save_hptr(pTHX_ HV** hptr); PERL_CALLCONV void Perl_save_I16(pTHX_ I16* intp); PERL_CALLCONV void Perl_save_I32(pTHX_ I32* intp); @@ -644,16 +644,16 @@ PERL_CALLCONV void Perl_save_re_context(pTHX); PERL_CALLCONV void Perl_save_padsv(pTHX_ PADOFFSET off); PERL_CALLCONV void Perl_save_sptr(pTHX_ SV** sptr); PERL_CALLCONV SV* Perl_save_svref(pTHX_ SV** sptr); -PERL_CALLCONV SV** Perl_save_threadsv(pTHX_ PADOFFSET i); +PERL_CALLCONV SV** Perl_save_threadsv(pTHX_ PADOFFSET i) __attribute__((noreturn)); PERL_CALLCONV OP* Perl_sawparens(pTHX_ OP* o); PERL_CALLCONV OP* Perl_scalar(pTHX_ OP* o); PERL_CALLCONV OP* Perl_scalarkids(pTHX_ OP* o); PERL_CALLCONV OP* Perl_scalarseq(pTHX_ OP* o); PERL_CALLCONV OP* Perl_scalarvoid(pTHX_ OP* o); -PERL_CALLCONV NV Perl_scan_bin(pTHX_ char* start, STRLEN len, STRLEN* retlen); -PERL_CALLCONV NV Perl_scan_hex(pTHX_ char* start, STRLEN len, STRLEN* retlen); +PERL_CALLCONV NV Perl_scan_bin(pTHX_ const char* start, STRLEN len, STRLEN* retlen); +PERL_CALLCONV NV Perl_scan_hex(pTHX_ const char* start, STRLEN len, STRLEN* retlen); PERL_CALLCONV char* Perl_scan_num(pTHX_ const char* s, YYSTYPE *lvalp); -PERL_CALLCONV NV Perl_scan_oct(pTHX_ char* start, STRLEN len, STRLEN* retlen); +PERL_CALLCONV NV Perl_scan_oct(pTHX_ const char* start, STRLEN len, STRLEN* retlen); PERL_CALLCONV OP* Perl_scope(pTHX_ OP* o); PERL_CALLCONV char* Perl_screaminstr(pTHX_ SV* bigsv, SV* littlesv, I32 start_shift, I32 end_shift, I32 *state, I32 last); #if !defined(VMS) @@ -881,7 +881,7 @@ PERL_CALLCONV SV* Perl_sv_rvweaken(pTHX_ SV *sv); PERL_CALLCONV int Perl_magic_killbackrefs(pTHX_ SV *sv, MAGIC *mg); PERL_CALLCONV OP* Perl_newANONATTRSUB(pTHX_ I32 floor, OP *proto, OP *attrs, OP *block); PERL_CALLCONV CV* Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block); -PERL_CALLCONV void Perl_newMYSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block); +PERL_CALLCONV void Perl_newMYSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block) __attribute__((noreturn)); PERL_CALLCONV OP * Perl_my_attrs(pTHX_ OP *o, OP *attrs); PERL_CALLCONV void Perl_boot_core_xsutils(pTHX); #if defined(USE_ITHREADS) @@ -949,7 +949,7 @@ STATIC HEK* S_save_hek_flags(pTHX_ const char *str, I32 len, U32 hash, int flags STATIC void S_hv_magic_check(pTHX_ HV *hv, bool *needs_copy, bool *needs_store); STATIC void S_unshare_hek_or_pvn(pTHX_ HEK* hek, const char* sv, I32 len, U32 hash); STATIC HEK* S_share_hek_flags(pTHX_ const char* sv, I32 len, U32 hash, int flags); -STATIC void S_hv_notallowed(pTHX_ int flags, const char *key, I32 klen, const char *msg); +STATIC void S_hv_notallowed(pTHX_ int flags, const char *key, I32 klen, const char *msg) __attribute__((noreturn)); #endif #if defined(PERL_IN_MG_C) || defined(PERL_DECL_PROT) @@ -1207,7 +1207,7 @@ STATIC void S_incline(pTHX_ char *s); STATIC int S_intuit_method(pTHX_ char *s, GV *gv); STATIC int S_intuit_more(pTHX_ char *s); STATIC I32 S_lop(pTHX_ I32 f, int x, char *s); -STATIC void S_missingterm(pTHX_ char *s); +STATIC void S_missingterm(pTHX_ char *s) __attribute__((noreturn)); STATIC void S_no_op(pTHX_ const char *what, char *s); STATIC void S_set_csh(pTHX); STATIC I32 S_sublex_done(pTHX); diff --git a/regcomp.c b/regcomp.c index 713669c..4a25d0c 100644 --- a/regcomp.c +++ b/regcomp.c @@ -6267,7 +6267,7 @@ S_re_croak2(pTHX_ const char* pat1,const char* pat2,...) STRLEN l2 = strlen(pat2); char buf[512]; SV *msv; - char *message; + const char *message; if (l1 > 510) l1 = 510; diff --git a/scope.c b/scope.c index 56ea96f..9bb89b7 100644 --- a/scope.c +++ b/scope.c @@ -466,6 +466,7 @@ SV ** Perl_save_threadsv(pTHX_ PADOFFSET i) { Perl_croak(aTHX_ "panic: save_threadsv called in non-threaded perl"); + (void)i; return 0; } diff --git a/sv.c b/sv.c index 8d8b446..4f0fa98 100644 --- a/sv.c +++ b/sv.c @@ -3458,7 +3458,7 @@ Perl_sv_2pv_flags(pTHX_ register SV *sv, STRLEN *lp, I32 flags) if (!sv) { *lp = 0; - return ""; + return (char *)""; } if (SvGMAGICAL(sv)) { if (flags & SV_GMAGIC) @@ -3486,7 +3486,7 @@ Perl_sv_2pv_flags(pTHX_ register SV *sv, STRLEN *lp, I32 flags) report_uninit(sv); } *lp = 0; - return ""; + return (char *)""; } } if (SvTHINKFIRST(sv)) { @@ -3626,13 +3626,13 @@ Perl_sv_2pv_flags(pTHX_ register SV *sv, STRLEN *lp, I32 flags) goto tokensaveref; } *lp = strlen(typestr); - return typestr; + return (char *)typestr; } if (SvREADONLY(sv) && !SvOK(sv)) { if (ckWARN(WARN_UNINITIALIZED)) report_uninit(sv); *lp = 0; - return ""; + return (char *)""; } } if (SvIOK(sv) || ((SvIOKp(sv) && !SvNOKp(sv)))) { @@ -3695,7 +3695,7 @@ Perl_sv_2pv_flags(pTHX_ register SV *sv, STRLEN *lp, I32 flags) if (SvTYPE(sv) < SVt_PV) /* Typically the caller expects that sv_any is not NULL now. */ sv_upgrade(sv, SVt_PV); - return ""; + return (char *)""; } *lp = s - SvPVX(sv); SvCUR_set(sv, *lp); @@ -3717,7 +3717,7 @@ Perl_sv_2pv_flags(pTHX_ register SV *sv, STRLEN *lp, I32 flags) } else { STRLEN len; - char *t; + const char *t; if (tsv) { sv_2mortal(tsv); @@ -9141,6 +9141,8 @@ missing (NULL). When running with taint checks enabled, indicates via C if results are untrustworthy (often due to the use of locales). +XXX Except that it maybe_tainted is never assigned to. + Usually used via one of its frontends C and C. =cut @@ -9178,7 +9180,7 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV switch (pat[1]) { case 's': if (args) { - char *s = va_arg(*args, char*); + const char *s = va_arg(*args, char*); sv_catpv(sv, s ? s : nullstr); } else if (svix < svmax) { @@ -10308,6 +10310,8 @@ PerlIO * Perl_fp_dup(pTHX_ PerlIO *fp, char type, CLONE_PARAMS *param) { PerlIO *ret; + (void)type; + if (!fp) return (PerlIO*)NULL; diff --git a/taint.c b/taint.c index c2865fa..f21aedc 100644 --- a/taint.c +++ b/taint.c @@ -91,7 +91,7 @@ Perl_taint_env(pTHX) if (!GvHV(PL_envgv) || !(SvRMAGICAL(GvHV(PL_envgv)) && mg_find((SV*)GvHV(PL_envgv), PERL_MAGIC_env))) { const bool was_tainted = PL_tainted; - char *name = GvENAME(PL_envgv); + const char *name = GvENAME(PL_envgv); PL_tainted = TRUE; if (strEQ(name,"ENV")) /* hash alias */ @@ -144,7 +144,7 @@ Perl_taint_env(pTHX) svp = hv_fetch(GvHVn(PL_envgv),"TERM",4,FALSE); if (svp && *svp && SvTAINTED(*svp)) { STRLEN n_a; - bool was_tainted = PL_tainted; + const bool was_tainted = PL_tainted; char *t = SvPV(*svp, n_a); char *e = t + n_a; PL_tainted = was_tainted; diff --git a/toke.c b/toke.c index c2c7ba2..7bbe2bd 100644 --- a/toke.c +++ b/toke.c @@ -9419,6 +9419,8 @@ S_scan_heredoc(pTHX_ register char *s) I32 len; SV *tmpstr; char term; + const char newline[] = "\n"; + const char *found_newline; register char *d; register char *e; char *peek; @@ -9479,11 +9481,13 @@ S_scan_heredoc(pTHX_ register char *s) s = olds; } #endif - d = "\n"; - if (outer || !(d=ninstr(s,PL_bufend,d,d+1))) - herewas = newSVpvn(s,PL_bufend-s); - else - s--, herewas = newSVpvn(s,d-s); + if ( outer || !(found_newline = ninstr(s,PL_bufend,newline,newline+1)) ) { + herewas = newSVpvn(s,PL_bufend-s); + } + else { + s--; + herewas = newSVpvn(s,found_newline-s); + } s += SvCUR(herewas); tmpstr = NEWSV(87,79); @@ -10489,7 +10493,7 @@ vstring: else lvalp->opval = Nullop; - return s; + return (char *)s; } STATIC char * @@ -10915,7 +10919,7 @@ Perl_scan_vstring(pTHX_ const char *s, SV *sv) if ((PL_bufend - next) >= 2 && *next == '=' && next[1] == '>' ) { /* return string not v-string */ sv_setpvn(sv,(char *)s,pos-s); - return pos; + return (char *)pos; } } @@ -10968,6 +10972,6 @@ Perl_scan_vstring(pTHX_ const char *s, SV *sv) sv_magic(sv,NULL,PERL_MAGIC_vstring,(const char*)start, pos-start); SvRMAGICAL_on(sv); } - return s; + return (char *)s; } diff --git a/utf8.c b/utf8.c index bb31862..6fc0680 100644 --- a/utf8.c +++ b/utf8.c @@ -787,7 +787,7 @@ Perl_bytes_from_utf8(pTHX_ const U8 *s, STRLEN *len, bool *is_utf8) I32 count = 0; if (!*is_utf8) - return start; + return (U8 *)start; /* ensure valid UTF-8 and chars < 256 before converting string */ for (send = s + *len; s < send;) { @@ -797,7 +797,7 @@ Perl_bytes_from_utf8(pTHX_ const U8 *s, STRLEN *len, bool *is_utf8) (c = *s++) && UTF8_IS_CONTINUATION(c)) count++; else - return start; + return (U8 *)start; } } @@ -816,7 +816,7 @@ Perl_bytes_from_utf8(pTHX_ const U8 *s, STRLEN *len, bool *is_utf8) } *d = '\0'; *len = d - start; - return start; + return (U8 *)start; } /* @@ -1620,7 +1620,7 @@ Perl_swash_init(pTHX_ const char* pkg, const char* name, SV *listsv, I32 minbits POPSTACK; if (IN_PERL_COMPILETIME) { STRLEN len; - char* pv = SvPV(tokenbufsv, len); + const char* pv = SvPV(tokenbufsv, len); Copy(pv, PL_tokenbuf, len+1, char); PL_curcop->op_private = (U8)(PL_hints & HINT_PRIVATE_MASK); diff --git a/util.c b/util.c index ca78177..afbe19e 100644 --- a/util.c +++ b/util.c @@ -246,7 +246,7 @@ Perl_delimcpy(pTHX_ register char *to, register const char *toend, register cons if (to < toend) *to = '\0'; *retlen = tolen; - return from; + return (char *)from; } /* return ptr to little string in big string, NULL if not found */ @@ -1142,7 +1142,7 @@ S_vdie_common(pTHX_ const char *message, STRLEN msglen, I32 utf8) OP * Perl_vdie(pTHX_ const char* pat, va_list *args) { - char *message; + const char *message; const int was_in_eval = PL_in_eval; STRLEN msglen; I32 utf8 = 0; @@ -1191,7 +1191,7 @@ Perl_die(pTHX_ const char* pat, ...) void Perl_vcroak(pTHX_ const char* pat, va_list *args) { - char *message; + const char *message; STRLEN msglen; I32 utf8 = 0; @@ -2758,6 +2758,7 @@ Perl_find_script(pTHX_ const char *scriptname, bool dosearch, const char **searc int extidx = 0, i = 0; const char *curext = Nullch; #else + (void)search_ext; # define MAX_EXT_LEN 0 #endif @@ -3918,7 +3919,7 @@ Perl_scan_version(pTHX_ const char *s, SV *rv, bool qv) while (len-- > 0) av_push((AV *)sv, newSViv(0)); } - return s; + return (char *)s; } /* @@ -4465,6 +4466,7 @@ some level of strict-ness. void Perl_sv_nosharing(pTHX_ SV *sv) { + (void)sv; } /* @@ -4480,6 +4482,7 @@ some level of strict-ness. void Perl_sv_nolocking(pTHX_ SV *sv) { + (void)sv; } @@ -4496,6 +4499,7 @@ some level of strict-ness. void Perl_sv_nounlocking(pTHX_ SV *sv) { + (void)sv; } U32