develooper Front page | perl.perl5.porters | Postings from January 2008

[PATCH] toke.c/universal.c: consting

Thread Next
From:
Steven Schubiger
Date:
January 28, 2008 05:01
Subject:
[PATCH] toke.c/universal.c: consting
Message ID:
20080128125741.GA27390@refcnt.homeunix.org
Make regen required (does embed.fnc not contain a corresponding line
for newSV_maybe_utf8 by intention?)

Steven Schubiger

diff -ru perl-current/embed.fnc perl-hack/embed.fnc
--- perl-current/embed.fnc	2008-01-28 11:03:19.000000000 +0100
+++ perl-hack/embed.fnc	2008-01-28 13:26:49.000000000 +0100
@@ -183,8 +183,8 @@
 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 @@
 				|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 @@
 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 @@
 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 @@
 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 @@
 #  endif
 #  if defined(DEBUGGING)
 s	|int	|tokereport	|I32 rv
-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 -ru perl-current/toke.c perl-hack/toke.c
--- perl-current/toke.c	2008-01-11 14:57:52.000000000 +0100
+++ perl-hack/toke.c	2008-01-28 13:19:56.000000000 +0100
@@ -435,7 +435,7 @@
 /* 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 @@
  */
 
 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 @@
  * 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 @@
  */
 
 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 @@
 #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) {
@@ -1342,7 +1342,7 @@
 }
 
 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,
@@ -10794,7 +10794,7 @@
 {
     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;
@@ -12423,7 +12423,7 @@
 #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;
@@ -12433,7 +12433,7 @@
 }
 
 int
-Perl_yyerror(pTHX_ const char *s)
+Perl_yyerror(pTHX_ const char *const s)
 {
     dVAR;
     const char *where = NULL;
@@ -12713,7 +12713,7 @@
 */
 
 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 -ru perl-current/universal.c perl-hack/universal.c
--- perl-current/universal.c	2008-01-09 11:59:16.000000000 +0100
+++ perl-hack/universal.c	2008-01-28 13:19:52.000000000 +0100
@@ -91,7 +91,7 @@
 */
 
 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 @@
 #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;

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About