This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Use isGV_with_GP in util.c:fbm_compile
authorFather Chrysostomos <sprout@cpan.org>
Thu, 24 May 2012 21:49:19 +0000 (14:49 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Wed, 30 May 2012 06:55:23 +0000 (23:55 -0700)
This little statement:

    if (SvSCREAM(sv))
return;

filters out not only studied strings, but also GVs.

Since studied strings are gone, it only filters out GVs now.  Since
fbm_compile coerces its argument, we still want to filter out GVs, so
we use isGV_with_GP to make the intent clear.

util.c

diff --git a/util.c b/util.c
index 7a8f3bb..6512160 100644 (file)
--- a/util.c
+++ b/util.c
@@ -557,11 +557,7 @@ Perl_fbm_compile(pTHX_ SV *sv, U32 flags)
 
     PERL_ARGS_ASSERT_FBM_COMPILE;
 
-    /* Refuse to fbm_compile a studied scalar, as this gives more flexibility in
-       SV flag usage.  No real-world code would ever end up using a studied
-       scalar as a compile-time second argument to index, so this isn't a real
-       pessimisation.  */
-    if (SvSCREAM(sv))
+    if (isGV_with_GP(sv))
        return;
 
     if (SvVALID(sv))