From: Steven Schubiger Date: Mon, 28 Jan 2008 13:57:41 +0000 (+0100) Subject: toke.c/universal.c: consting X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=15f169a1089447c7f805778ce6caca1f591d50fc;p=p5sagit%2Fp5-mst-13.2.git toke.c/universal.c: consting Message-ID: <20080128125741.GA27390@refcnt.homeunix.org> p4raw-id: //depot/perl@33103 --- diff --git a/embed.fnc b/embed.fnc index 45bf8ec..abf6cb9 100644 --- a/embed.fnc +++ b/embed.fnc @@ -183,8 +183,8 @@ Ap |I32 |debstackptrs Ap |char* |delimcpy |NN char* to|NN const char* toend|NN const char* from \ |NN const char* fromend|int delim|NN I32* retlen pM |void |delete_eval_scope -p |void |deprecate |NN const char* s -p |void |deprecate_old |NN const char* s +p |void |deprecate |NN const char *const s +p |void |deprecate_old |NN const char *const s Afp |OP* |die |NULLOK const char* pat|... p |OP* |vdie |NULLOK const char* pat|NULLOK va_list* args p |OP* |die_where |NULLOK const char* message|STRLEN msglen @@ -604,7 +604,7 @@ Apa |OP* |newWHILEOP |I32 flags|I32 debuggable|NULLOK LOOP* loop \ |I32 whileline|NULLOK OP* expr|NULLOK OP* block|NULLOK OP* cont \ |I32 has_my Apa |PERL_SI*|new_stackinfo|I32 stitems|I32 cxitems -Ap |char* |scan_vstring |NN const char *vstr|NN const char *end|NN SV *sv +Ap |char* |scan_vstring |NN const char *vstr|NN const char *const end|NN SV *sv Apd |const char* |scan_version |NN const char *vstr|NN SV *sv|bool qv Apd |SV* |new_version |NN SV *ver Apd |SV* |upg_version |NN SV *ver|bool qv @@ -852,8 +852,8 @@ Ap |OP* |sv_compile_2op |NN SV* sv|NN OP** startp|NN const char* code|NN PAD** p Apd |int |getcwd_sv |NN SV* sv Apd |void |sv_dec |NN SV* sv Ap |void |sv_dump |NN SV* sv -ApdR |bool |sv_derived_from|NN SV* sv|NN const char* name -ApdR |bool |sv_does |NN SV* sv|NN const char* name +ApdR |bool |sv_derived_from|NN SV* sv|NN const char *const name +ApdR |bool |sv_does |NN SV* sv|NN const char *const name Apd |I32 |sv_eq |NULLOK SV* sv1|NULLOK SV* sv2 Apd |void |sv_free |NULLOK SV* sv poMX |void |sv_free2 |NN SV* sv @@ -989,11 +989,11 @@ Ap |void |vwarner |U32 err|NN const char* pat|NULLOK va_list* args p |void |watch |NN char** addr Ap |I32 |whichsig |NN const char* sig p |void |write_to_stderr|NN const char* message|int msglen -p |int |yyerror |NN const char* s +p |int |yyerror |NN const char *const s EXp |int |yylex p |int |yyparse p |void |parser_free |NN const yy_parser * -p |int |yywarn |NN const char* s +p |int |yywarn |NN const char *const s #if defined(MYMALLOC) Ap |void |dump_mstats |NN char* s Ap |int |get_mstats |NN perl_mstats_t *buf|int buflen|int level @@ -1555,19 +1555,19 @@ sR |char* |scan_trans |NN char *start s |char* |scan_word |NN char *s|NN char *dest|STRLEN destlen \ |int allow_package|NN STRLEN *slp s |void |update_debugger_info|NULLOK SV *orig_sv \ - |NULLOK const char *buf|STRLEN len + |NULLOK const char *const buf|STRLEN len sR |char* |skipspace |NN char *s sR |char* |swallow_bom |NN U8 *s s |void |checkcomma |NN const char *s|NN const char *name \ |NN const char *what -s |bool |feature_is_enabled|NN const char* name|STRLEN namelen +s |bool |feature_is_enabled|NN const char *const name|STRLEN namelen s |void |force_ident |NN const char *s|int kind s |void |incline |NN const char *s s |int |intuit_method |NN char *s|NULLOK GV *gv|NULLOK CV *cv s |int |intuit_more |NN char *s s |I32 |lop |I32 f|int x|NN char *s rs |void |missingterm |NULLOK char *s -s |void |no_op |NN const char *what|NULLOK char *s +s |void |no_op |NN const char *const what|NULLOK char *s sR |I32 |sublex_done sR |I32 |sublex_push sR |I32 |sublex_start @@ -1585,7 +1585,7 @@ s |void |strip_return |NN SV *sv # endif # if defined(DEBUGGING) s |int |tokereport |I32 rv|NN const YYSTYPE* lvalp -s |void |printbuf |NN const char* fmt|NN const char* s +s |void |printbuf |NN const char *const fmt|NN const char* s # endif #endif diff --git a/pod/perlapi.pod b/pod/perlapi.pod index ce39d2a..28d7277 100644 --- a/pod/perlapi.pod +++ b/pod/perlapi.pod @@ -5047,7 +5047,7 @@ Returns a boolean indicating whether the SV is derived from the specified class I. To check derivation at the Perl level, call C as a normal Perl method. - bool sv_derived_from(SV* sv, const char* name) + bool sv_derived_from(SV* sv, const char *const name) =for hackers Found in file universal.c @@ -5058,7 +5058,7 @@ X Returns a boolean indicating whether the SV performs a specific, named role. The SV can be a Perl object or the name of a Perl class. - bool sv_does(SV* sv, const char* name) + bool sv_does(SV* sv, const char *const name) =for hackers Found in file universal.c diff --git a/proto.h b/proto.h index 79a369b..14a2e48 100644 --- a/proto.h +++ b/proto.h @@ -394,10 +394,10 @@ PERL_CALLCONV char* Perl_delimcpy(pTHX_ char* to, const char* toend, const char* __attribute__nonnull__(pTHX_6); PERL_CALLCONV void Perl_delete_eval_scope(pTHX); -PERL_CALLCONV void Perl_deprecate(pTHX_ const char* s) +PERL_CALLCONV void Perl_deprecate(pTHX_ const char *const s) __attribute__nonnull__(pTHX_1); -PERL_CALLCONV void Perl_deprecate_old(pTHX_ const char* s) +PERL_CALLCONV void Perl_deprecate_old(pTHX_ const char *const s) __attribute__nonnull__(pTHX_1); PERL_CALLCONV OP* Perl_die(pTHX_ const char* pat, ...) @@ -1662,7 +1662,7 @@ PERL_CALLCONV PERL_SI* Perl_new_stackinfo(pTHX_ I32 stitems, I32 cxitems) __attribute__malloc__ __attribute__warn_unused_result__; -PERL_CALLCONV char* Perl_scan_vstring(pTHX_ const char *vstr, const char *end, SV *sv) +PERL_CALLCONV char* Perl_scan_vstring(pTHX_ const char *vstr, const char *const end, SV *sv) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3); @@ -2290,12 +2290,12 @@ PERL_CALLCONV void Perl_sv_dec(pTHX_ SV* sv) PERL_CALLCONV void Perl_sv_dump(pTHX_ SV* sv) __attribute__nonnull__(pTHX_1); -PERL_CALLCONV bool Perl_sv_derived_from(pTHX_ SV* sv, const char* name) +PERL_CALLCONV bool Perl_sv_derived_from(pTHX_ SV* sv, const char *const name) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); -PERL_CALLCONV bool Perl_sv_does(pTHX_ SV* sv, const char* name) +PERL_CALLCONV bool Perl_sv_does(pTHX_ SV* sv, const char *const name) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); @@ -2658,7 +2658,7 @@ PERL_CALLCONV I32 Perl_whichsig(pTHX_ const char* sig) PERL_CALLCONV void Perl_write_to_stderr(pTHX_ const char* message, int msglen) __attribute__nonnull__(pTHX_1); -PERL_CALLCONV int Perl_yyerror(pTHX_ const char* s) +PERL_CALLCONV int Perl_yyerror(pTHX_ const char *const s) __attribute__nonnull__(pTHX_1); PERL_CALLCONV int Perl_yylex(pTHX); @@ -2666,7 +2666,7 @@ PERL_CALLCONV int Perl_yyparse(pTHX); PERL_CALLCONV void Perl_parser_free(pTHX_ const yy_parser *) __attribute__nonnull__(pTHX_1); -PERL_CALLCONV int Perl_yywarn(pTHX_ const char* s) +PERL_CALLCONV int Perl_yywarn(pTHX_ const char *const s) __attribute__nonnull__(pTHX_1); #if defined(MYMALLOC) @@ -4096,7 +4096,7 @@ STATIC char* S_scan_word(pTHX_ char *s, char *dest, STRLEN destlen, int allow_pa __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_5); -STATIC void S_update_debugger_info(pTHX_ SV *orig_sv, const char *buf, STRLEN len); +STATIC void S_update_debugger_info(pTHX_ SV *orig_sv, const char *const buf, STRLEN len); STATIC char* S_skipspace(pTHX_ char *s) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1); @@ -4110,7 +4110,7 @@ STATIC void S_checkcomma(pTHX_ const char *s, const char *name, const char *what __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3); -STATIC bool S_feature_is_enabled(pTHX_ const char* name, STRLEN namelen) +STATIC bool S_feature_is_enabled(pTHX_ const char *const name, STRLEN namelen) __attribute__nonnull__(pTHX_1); STATIC void S_force_ident(pTHX_ const char *s, int kind) @@ -4131,7 +4131,7 @@ STATIC I32 S_lop(pTHX_ I32 f, int x, 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_no_op(pTHX_ const char *const what, char *s) __attribute__nonnull__(pTHX_1); STATIC I32 S_sublex_done(pTHX) @@ -4171,7 +4171,7 @@ STATIC void S_strip_return(pTHX_ SV *sv) STATIC int S_tokereport(pTHX_ I32 rv, const YYSTYPE* lvalp) __attribute__nonnull__(pTHX_2); -STATIC void S_printbuf(pTHX_ const char* fmt, const char* s) +STATIC void S_printbuf(pTHX_ const char *const fmt, const char* s) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); diff --git a/toke.c b/toke.c index afcc1dd..2ae8b75 100644 --- a/toke.c +++ b/toke.c @@ -435,7 +435,7 @@ S_tokereport(pTHX_ I32 rv, const YYSTYPE* lvalp) /* print the buffer with suitable escapes */ STATIC void -S_printbuf(pTHX_ const char* fmt, const char* s) +S_printbuf(pTHX_ const char *const fmt, const char *const s) { SV* const tmp = newSVpvs(""); PerlIO_printf(Perl_debug_log, fmt, pv_display(tmp, s, strlen(s), 0, 60)); @@ -482,7 +482,7 @@ S_ao(pTHX_ int toketype) */ STATIC void -S_no_op(pTHX_ const char *what, char *s) +S_no_op(pTHX_ const char *const what, char *s) { dVAR; char * const oldbp = PL_bufptr; @@ -567,7 +567,7 @@ S_missingterm(pTHX_ char *s) * Check whether the named feature is enabled. */ STATIC bool -S_feature_is_enabled(pTHX_ const char *name, STRLEN namelen) +S_feature_is_enabled(pTHX_ const char *const name, STRLEN namelen) { dVAR; HV * const hinthv = GvHV(PL_hintgv); @@ -583,14 +583,14 @@ S_feature_is_enabled(pTHX_ const char *name, STRLEN namelen) */ void -Perl_deprecate(pTHX_ const char *s) +Perl_deprecate(pTHX_ const char *const s) { if (ckWARN(WARN_DEPRECATED)) Perl_warner(aTHX_ packWARN(WARN_DEPRECATED), "Use of %s is deprecated", s); } void -Perl_deprecate_old(pTHX_ const char *s) +Perl_deprecate_old(pTHX_ const char *const s) { /* This function should NOT be called for any new deprecated warnings */ /* Use Perl_deprecate instead */ @@ -970,7 +970,7 @@ S_skipspace2(pTHX_ register char *s, SV **svp) #endif STATIC void -S_update_debugger_info(pTHX_ SV *orig_sv, const char *buf, STRLEN len) +S_update_debugger_info(pTHX_ SV *orig_sv, const char *const buf, STRLEN len) { AV *av = CopFILEAVx(PL_curcop); if (av) { @@ -1348,7 +1348,7 @@ S_force_next(pTHX_ I32 type) } STATIC SV * -S_newSV_maybe_utf8(pTHX_ const char *start, STRLEN len) +S_newSV_maybe_utf8(pTHX_ const char *const start, STRLEN len) { dVAR; SV * const sv = newSVpvn_utf8(start, len, @@ -10800,7 +10800,7 @@ Perl_pmflag(pTHX_ U32* pmfl, int ch) { PERL_UNUSED_CONTEXT; if (ch<256) { - char c = (char)ch; + const char c = (char)ch; switch (c) { CASE_STD_PMMOD_FLAGS_PARSE_SET(pmfl); case GLOBAL_PAT_MOD: *pmfl |= PMf_GLOBAL; break; @@ -12429,7 +12429,7 @@ Perl_start_subparse(pTHX_ I32 is_format, U32 flags) #pragma segment Perl_yylex #endif int -Perl_yywarn(pTHX_ const char *s) +Perl_yywarn(pTHX_ const char *const s) { dVAR; PL_in_eval |= EVAL_WARNONLY; @@ -12439,7 +12439,7 @@ Perl_yywarn(pTHX_ const char *s) } int -Perl_yyerror(pTHX_ const char *s) +Perl_yyerror(pTHX_ const char *const s) { dVAR; const char *where = NULL; @@ -12719,7 +12719,7 @@ passed in, for performance reasons. */ char * -Perl_scan_vstring(pTHX_ const char *s, const char *e, SV *sv) +Perl_scan_vstring(pTHX_ const char *s, const char *const e, SV *sv) { dVAR; const char *pos = s; diff --git a/universal.c b/universal.c index c835286..7298559 100644 --- a/universal.c +++ b/universal.c @@ -91,7 +91,7 @@ normal Perl method. */ bool -Perl_sv_derived_from(pTHX_ SV *sv, const char *name) +Perl_sv_derived_from(pTHX_ SV *sv, const char *const name) { dVAR; HV *stash; @@ -131,7 +131,7 @@ The SV can be a Perl object or the name of a Perl class. #include "XSUB.h" bool -Perl_sv_does(pTHX_ SV *sv, const char *name) +Perl_sv_does(pTHX_ SV *sv, const char *const name) { const char *classname; bool does_it;