This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Add a constant 0 element before inversion lists
authorKarl Williamson <public@khwilliamson.com>
Mon, 11 Feb 2013 19:07:00 +0000 (12:07 -0700)
committerKarl Williamson <public@khwilliamson.com>
Thu, 4 Jul 2013 01:21:16 +0000 (19:21 -0600)
commit533c4e2f08b42d977e5004e823d4849f7473d2d0
treeb5b9d1f80b1b1069c67bc7467ea61c34ca396df1
parentccbd2626ed2f48a52d8b29a6c007fb3736570c9e
regcomp.c: Add a constant 0 element before inversion lists

This commit is the first step to separating the header from the body of
inversion lists.  Doing so will allow the compiled-in inversion lists to
be fully read-only.

To invert an inversion list, one simply unshifts a 0 to the front of it
if one is not there, and shifts off the 0 if it does have one.

The current data structure reserves an element at the beginning of each
inversion list that is either 0 or 1.  If 0, it means the inversion list
begins there; if 1, it means the inversion list starts at the next
element.  Inverting involves flipping this bit.

This commit changes the structure so that there is an additional element
just after the element that flips.  This new element is always 0, and
the flipping element now says whether the inversion list begins at the
constant 0 element, or the one after that.

Doing this allows the flipping element to be separated in later commits
from the body of the inversion list, which will always begin with the
constant 0 element.  That means that the body of the inversion list can
be const.
charclass_invlists.h
embed.fnc
inline_invlist.c
proto.h
regcomp.c
regen/mk_invlists.pl