summaryrefslogtreecommitdiff
path: root/inline.h
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2015-02-26 11:21:16 +1100
committerTony Cook <tony@develop-help.com>2015-02-26 11:21:16 +1100
commited38223246c041b4e9ce5687cadf6f6b903050ca (patch)
treeba8699c69934cb733ca509740eb98775652334c2 /inline.h
parente11fa374c86b187ae1e8382680d49e2e44abf1bb (diff)
downloadperl-ed38223246c041b4e9ce5687cadf6f6b903050ca.tar.gz
[perl #123202] speed up scalar //g against tainted strings
Diffstat (limited to 'inline.h')
-rw-r--r--inline.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/inline.h b/inline.h
index cde2c540e2..11244128a0 100644
--- a/inline.h
+++ b/inline.h
@@ -378,6 +378,30 @@ get_regex_charset_name(const U32 flags, STRLEN* const lenp)
}
/*
+
+Return false if any get magic is on the SV other than taint magic.
+
+*/
+
+PERL_STATIC_INLINE bool
+S_sv_only_taint_gmagic(SV *sv) {
+ MAGIC *mg = SvMAGIC(sv);
+
+ PERL_ARGS_ASSERT_SV_ONLY_TAINT_GMAGIC;
+
+ while (mg) {
+ if (mg->mg_type != PERL_MAGIC_taint
+ && !(mg->mg_flags & MGf_GSKIP)
+ && mg->mg_virtual->svt_get) {
+ return FALSE;
+ }
+ mg = mg->mg_moremagic;
+ }
+
+ return TRUE;
+}
+
+/*
* Local variables:
* c-indentation-style: bsd
* c-basic-offset: 4