This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regexec.c: regrepeat() change default: handling
authorKarl Williamson <public@khwilliamson.com>
Fri, 19 Oct 2012 17:57:16 +0000 (11:57 -0600)
committerKarl Williamson <public@khwilliamson.com>
Fri, 19 Oct 2012 18:20:22 +0000 (12:20 -0600)
commit584b1f026f7044a644ed30e0a7d9112db3d1b7ef
tree6045e4315d69bd65a778b9da6e288aad5763e047
parente64f369d58efdbd31eecf147ef006f0f69e17fc2
regexec.c: regrepeat() change default: handling

The core of this function is a large switch() statement.  Prior to this
commit, the default: case of it assumed that this meant that the
node-type was a zero-length node.  It is safer to explicitly mention
all the cases you expect to handle, and have the default fail so that
you know sooner that you forgot to handle a situation.  That is how all
other switch statements in this file are set up, and now this one is
too.

I added cases for all the node types in regcomp.c that are SIMPLE, and
hence could conceivably be handled by regrepeat(), and changed the
default: case to croak.

I considered doing an #ifdef DEBUGGING around this, but no other
switches() in the file do so, so I followed that paradigm.
regexec.c