summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-05-23 21:52:40 +0100
committerNicholas Clark <nick@ccl4.org>2011-06-11 09:40:01 +0200
commit4265b45d3e4359a48158b96f90aa017ade60632c (patch)
treebc36f6848add34deb2e0d0fa2b5d6d540fbbf560 /util.c
parentbc9a525687b7ccee10de7bc6f6a729645b1058dd (diff)
downloadperl-4265b45d3e4359a48158b96f90aa017ade60632c.tar.gz
Don't fbm_compile() studied scalars, to give 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.
Diffstat (limited to 'util.c')
-rw-r--r--util.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/util.c b/util.c
index 1c90fb0b6f..1c68f3d50b 100644
--- a/util.c
+++ b/util.c
@@ -552,6 +552,13 @@ 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))
+ return;
+
if (flags & FBMcf_TAIL) {
MAGIC * const mg = SvUTF8(sv) && SvMAGICAL(sv) ? mg_find(sv, PERL_MAGIC_utf8) : NULL;
sv_catpvs(sv, "\n"); /* Taken into account in fbm_instr() */