This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
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.