From: Karl Williamson Date: Thu, 16 Jan 2014 17:23:31 +0000 (-0700) Subject: Turn on read-only flag for some unchangeable inversion lists X-Git-Tag: upstream/5.20.0~764 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dbfdbd2685aa055f4e4a3b9cb568635771805959;p=platform%2Fupstream%2Fperl.git Turn on read-only flag for some unchangeable inversion lists These lists are read-only. Turning on the flag may allow some optimisations to be done, including some that may be added in the future. --- diff --git a/regcomp.c b/regcomp.c index d531053..decbe4a 100644 --- a/regcomp.c +++ b/regcomp.c @@ -7686,6 +7686,8 @@ Perl__new_invlist_C_array(pTHX_ const UV* const list) /* Initialize the iteration pointer. */ invlist_iterfinish(invlist); + SvREADONLY_on(invlist); + return invlist; } #endif /* ifndef PERL_IN_XSUB_RE */ diff --git a/utf8.c b/utf8.c index f4b9dc6..1b198bf 100644 --- a/utf8.c +++ b/utf8.c @@ -2735,6 +2735,8 @@ Perl__core_swash_init(pTHX_ const char* pkg, const char* name, SV *listsv, I32 m else SvREFCNT_inc_simple_void_NN(swash_invlist); } + SvREADONLY_on(swash_invlist); + /* Use the inversion list stand-alone if small enough */ if ((int) _invlist_len(swash_invlist) <= invlist_swash_boundary) { SvREFCNT_dec(retval); @@ -3840,6 +3842,7 @@ Perl__swash_to_invlist(pTHX_ SV* const swash) sv_free(other); /* through with it! */ } + SvREADONLY_on(invlist); return invlist; }