diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-05-23 21:52:40 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-06-11 09:40:01 +0200 |
commit | 4265b45d3e4359a48158b96f90aa017ade60632c (patch) | |
tree | bc36f6848add34deb2e0d0fa2b5d6d540fbbf560 /util.c | |
parent | bc9a525687b7ccee10de7bc6f6a729645b1058dd (diff) | |
download | perl-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.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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() */ |