summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-05-18 10:49:43 +0100
committerNicholas Clark <nick@ccl4.org>2011-06-11 09:40:02 +0200
commit9402563ac1ee6a7649763b93342cb2940addf915 (patch)
tree3f35069eb1363ff7c030a9a13d994dc365e1a448 /util.c
parent21aeb718e9b2ffc24ed853a11c571efa7fc3555d (diff)
downloadperl-9402563ac1ee6a7649763b93342cb2940addf915.tar.gz
Exit early from Perl_fbm_compile() if the SV is already "compiled".
I believe that this can only happen if a constant subroutine is used more than once as the second argument to index.
Diffstat (limited to 'util.c')
-rw-r--r--util.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/util.c b/util.c
index 74d7bb8dec..165e61a918 100644
--- a/util.c
+++ b/util.c
@@ -559,6 +559,9 @@ Perl_fbm_compile(pTHX_ SV *sv, U32 flags)
if (SvSCREAM(sv))
return;
+ if (SvVALID(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() */