diff options
author | Karl Williamson <public@khwilliamson.com> | 2013-02-13 16:41:44 -0700 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2013-07-03 19:21:18 -0600 |
commit | 241136e0ed70738cccd6c4b20ce12b26231f30e5 (patch) | |
tree | eec035eb046ebd5bd4fc0b2a9af1a7146a750ffc | |
parent | d913fb457b732da4c31d0d1b8c085989a7ecd12d (diff) | |
download | perl-241136e0ed70738cccd6c4b20ce12b26231f30e5.tar.gz |
regcomp.c: Make C-array inversion lists const
The inversion lists that are compiled into a C header are now const.
-rw-r--r-- | charclass_invlists.h | 136 | ||||
-rw-r--r-- | embed.fnc | 2 | ||||
-rw-r--r-- | inline_invlist.c | 2 | ||||
-rw-r--r-- | proto.h | 2 | ||||
-rw-r--r-- | regcomp.c | 2 | ||||
-rw-r--r-- | regen/mk_invlists.pl | 4 |
6 files changed, 74 insertions, 74 deletions
diff --git a/charclass_invlists.h b/charclass_invlists.h index 88ebe67640..19500e7a12 100644 --- a/charclass_invlists.h +++ b/charclass_invlists.h @@ -9,9 +9,9 @@ #ifndef PERL_IN_XSUB_RE -static UV Latin1_invlist[] = { +static const UV Latin1_invlist[] = { 2, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 0, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -22,9 +22,9 @@ static UV Latin1_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV AboveLatin1_invlist[] = { +static const UV AboveLatin1_invlist[] = { 1, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -35,9 +35,9 @@ static UV AboveLatin1_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV ASCII_invlist[] = { +static const UV ASCII_invlist[] = { 2, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 0, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -48,9 +48,9 @@ static UV ASCII_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV L1Cased_invlist[] = { +static const UV L1Cased_invlist[] = { 16, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -76,9 +76,9 @@ static UV L1Cased_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV VertSpace_invlist[] = { +static const UV VertSpace_invlist[] = { 6, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -94,9 +94,9 @@ static UV VertSpace_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV PerlSpace_invlist[] = { +static const UV PerlSpace_invlist[] = { 4, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -110,9 +110,9 @@ static UV PerlSpace_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV XPerlSpace_invlist[] = { +static const UV XPerlSpace_invlist[] = { 22, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -144,9 +144,9 @@ static UV XPerlSpace_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV PosixAlnum_invlist[] = { +static const UV PosixAlnum_invlist[] = { 6, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -162,9 +162,9 @@ static UV PosixAlnum_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV L1PosixAlnum_invlist[] = { +static const UV L1PosixAlnum_invlist[] = { 18, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -192,9 +192,9 @@ static UV L1PosixAlnum_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV PosixAlpha_invlist[] = { +static const UV PosixAlpha_invlist[] = { 4, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -208,9 +208,9 @@ static UV PosixAlpha_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV L1PosixAlpha_invlist[] = { +static const UV L1PosixAlpha_invlist[] = { 16, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -236,9 +236,9 @@ static UV L1PosixAlpha_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV PosixBlank_invlist[] = { +static const UV PosixBlank_invlist[] = { 4, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -252,9 +252,9 @@ static UV PosixBlank_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV XPosixBlank_invlist[] = { +static const UV XPosixBlank_invlist[] = { 18, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -282,9 +282,9 @@ static UV XPosixBlank_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV PosixCntrl_invlist[] = { +static const UV PosixCntrl_invlist[] = { 4, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 0, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -297,9 +297,9 @@ static UV PosixCntrl_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV XPosixCntrl_invlist[] = { +static const UV XPosixCntrl_invlist[] = { 4, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 0, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -312,9 +312,9 @@ static UV XPosixCntrl_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV PosixDigit_invlist[] = { +static const UV PosixDigit_invlist[] = { 2, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -326,9 +326,9 @@ static UV PosixDigit_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV PosixGraph_invlist[] = { +static const UV PosixGraph_invlist[] = { 2, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -340,9 +340,9 @@ static UV PosixGraph_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV L1PosixGraph_invlist[] = { +static const UV L1PosixGraph_invlist[] = { 4, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -356,9 +356,9 @@ static UV L1PosixGraph_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV PosixLower_invlist[] = { +static const UV PosixLower_invlist[] = { 2, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -370,9 +370,9 @@ static UV PosixLower_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV L1PosixLower_invlist[] = { +static const UV L1PosixLower_invlist[] = { 12, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -394,9 +394,9 @@ static UV L1PosixLower_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV PosixPrint_invlist[] = { +static const UV PosixPrint_invlist[] = { 2, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -408,9 +408,9 @@ static UV PosixPrint_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV L1PosixPrint_invlist[] = { +static const UV L1PosixPrint_invlist[] = { 4, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -424,9 +424,9 @@ static UV L1PosixPrint_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV PosixPunct_invlist[] = { +static const UV PosixPunct_invlist[] = { 8, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -444,9 +444,9 @@ static UV PosixPunct_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV L1PosixPunct_invlist[] = { +static const UV L1PosixPunct_invlist[] = { 20, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -476,9 +476,9 @@ static UV L1PosixPunct_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV PosixSpace_invlist[] = { +static const UV PosixSpace_invlist[] = { 4, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -492,9 +492,9 @@ static UV PosixSpace_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV XPosixSpace_invlist[] = { +static const UV XPosixSpace_invlist[] = { 22, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -526,9 +526,9 @@ static UV XPosixSpace_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV PosixUpper_invlist[] = { +static const UV PosixUpper_invlist[] = { 2, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -540,9 +540,9 @@ static UV PosixUpper_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV L1PosixUpper_invlist[] = { +static const UV L1PosixUpper_invlist[] = { 6, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -558,9 +558,9 @@ static UV L1PosixUpper_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV PosixWord_invlist[] = { +static const UV PosixWord_invlist[] = { 8, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -578,9 +578,9 @@ static UV PosixWord_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV L1PosixWord_invlist[] = { +static const UV L1PosixWord_invlist[] = { 20, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -610,9 +610,9 @@ static UV L1PosixWord_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV PosixXDigit_invlist[] = { +static const UV PosixXDigit_invlist[] = { 6, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -628,9 +628,9 @@ static UV PosixXDigit_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV XPosixXDigit_invlist[] = { +static const UV XPosixXDigit_invlist[] = { 12, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -650,9 +650,9 @@ static UV XPosixXDigit_invlist[] = { #endif -static UV NonL1_Perl_Non_Final_Folds_invlist[] = { +static const UV NonL1_Perl_Non_Final_Folds_invlist[] = { 44, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -704,9 +704,9 @@ static UV NonL1_Perl_Non_Final_Folds_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV _Perl_Multi_Char_Folds_invlist[] = { +static const UV _Perl_Multi_Char_Folds_invlist[] = { 58, /* Number of elements */ - 1511554547, /* Version and data structure type */ + 1826693541, /* Version and data structure type */ 1, /* 0 if the list starts at 0; 1 if it starts at the element beyond 0 */ 0, @@ -1084,7 +1084,7 @@ Ap |SV* |regclass_swash |NULLOK const regexp *prog \ |NN const struct regnode *node|bool doinit \ |NULLOK SV **listsvp|NULLOK SV **altsvp #ifdef PERL_IN_REGCOMP_C -EMsR |SV* |_new_invlist_C_array|NN UV* list +EMsR |SV* |_new_invlist_C_array|NN const UV* const list : Not used currently: EXMs |bool |_invlistEQ |NN SV* const a|NN SV* const b|const bool complement_b #endif Ap |I32 |pregexec |NN REGEXP * const prog|NN char* stringarg \ diff --git a/inline_invlist.c b/inline_invlist.c index 936a298be5..c6bc47ef38 100644 --- a/inline_invlist.c +++ b/inline_invlist.c @@ -16,7 +16,7 @@ * in the range 2**31-1 should be generated. Then, if an auxiliary program * doesn't change correspondingly, it will be discovered immediately */ #define INVLIST_VERSION_ID_OFFSET 1 -#define INVLIST_VERSION_ID 1511554547 +#define INVLIST_VERSION_ID 1826693541 #define INVLIST_OFFSET_OFFSET 2 /* 0 or 1 */ /* The UV at this position contains either 0 or 1. If 0, the inversion list @@ -6416,7 +6416,7 @@ PERL_STATIC_INLINE UV* S__invlist_array_init(pTHX_ SV* const invlist, const bool #define PERL_ARGS_ASSERT__INVLIST_ARRAY_INIT \ assert(invlist) -STATIC SV* S__new_invlist_C_array(pTHX_ UV* list) +STATIC SV* S__new_invlist_C_array(pTHX_ const UV* const list) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT__NEW_INVLIST_C_ARRAY \ @@ -7239,7 +7239,7 @@ Perl__new_invlist(pTHX_ IV initial_size) #endif STATIC SV* -S__new_invlist_C_array(pTHX_ UV* list) +S__new_invlist_C_array(pTHX_ const UV* const list) { /* Return a pointer to a newly constructed inversion list, initialized to * point to <list>, which has to be in the exact correct inversion list diff --git a/regen/mk_invlists.pl b/regen/mk_invlists.pl index f1e1bd9843..5163907e60 100644 --- a/regen/mk_invlists.pl +++ b/regen/mk_invlists.pl @@ -15,7 +15,7 @@ require 'regen/regen_lib.pl'; # in the headers is used to minimize the possibility of things getting # out-of-sync, or the wrong data structure being passed. Currently that # random number is: -my $VERSION_DATA_STRUCTURE_TYPE = 1511554547; +my $VERSION_DATA_STRUCTURE_TYPE = 1826693541; my $out_fh = open_new('charclass_invlists.h', '>', {style => '*', by => $0, @@ -45,7 +45,7 @@ sub output_invlist ($$) { } print $out_fh "\n#ifndef PERL_IN_XSUB_RE\n" unless exists $include_in_ext_re{$name}; - print $out_fh "\nstatic UV ${name}_invlist[] = {\n"; + print $out_fh "\nstatic const UV ${name}_invlist[] = {\n"; print $out_fh "\t$count,\t/* Number of elements */\n"; print $out_fh "\t$VERSION_DATA_STRUCTURE_TYPE, /* Version and data structure type */\n"; |