Fix spurious "uninitialized value" warning in regex match
authorAaron Crane <arc@cpan.org>
Wed, 12 Sep 2012 15:04:38 +0000 (16:04 +0100)
committerKarl Williamson <public@khwilliamson.com>
Sat, 6 Oct 2012 16:13:42 +0000 (10:13 -0600)
commitc72077c4fff72b66cdde1621c62fb4fd383ce093
tree3ed77652c11a1b18c03c1da3b341bc076a174f64
parent4e09ec70cb4ef34d5ace1702e717659d45972d48
Fix spurious "uninitialized value" warning in regex match

The warning appeared if the pattern contains a floating substring for
which utf8 is needed, and the target string isn't in utf8.  In this
situation, downgrading the floating substring yields undef, which
triggers the warning.

Matching can't succeed in this situation, because it's impossible for
the non-utf8 target string to contain any string which needs utf8 for
its own representation.  So the warning is quelled by aborting the match
early.

Anchored substrings already have a check of this form; this commit makes
the corresponding change in the floating-substring case.
regexec.c
t/re/pat_advanced.t