aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2010-11-20 00:02:49 +0000
committerSimon McVittie <smcv@debian.org>2010-11-20 00:02:49 +0000
commit55515050e1f3aad13dc96796a347cefa98e8e472 (patch)
tree973ddcc14ee15b71cd950ff4dd5615885aa59284
parent788105e2a73a3be0f9a05a390702ee28318a5673 (diff)
downloadikiwiki-55515050e1f3aad13dc96796a347cefa98e8e472.tar
ikiwiki-55515050e1f3aad13dc96796a347cefa98e8e472.tar.gz
make use of precompiled regex objects
-rw-r--r--IkiWiki.pm4
-rw-r--r--IkiWiki/Plugin/filecheck.pm2
-rw-r--r--IkiWiki/Plugin/meta.pm2
-rw-r--r--IkiWiki/Plugin/po.pm2
4 files changed, 5 insertions, 5 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index bb7d46ccf..e5370f4a6 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -2495,7 +2495,7 @@ sub match_glob ($$;@) {
# cache the compiled regex to save time.
if (!defined $glob_cache{$glob}) {
my $re = IkiWiki::glob2re($glob);
- $glob_cache{$glob} = qr/^$re$/i;
+ $glob_cache{$glob} = $re;
}
if ($page=~ $glob_cache{$glob}) {
if (! IkiWiki::isinternal($page) || $params{internal}) {
@@ -2667,7 +2667,7 @@ sub match_user ($$;@) {
return IkiWiki::ErrorReason->new("no user specified");
}
- if (defined $params{user} && $params{user}=~/^$regexp$/i) {
+ if (defined $params{user} && $params{user}=~$regexp) {
return IkiWiki::SuccessReason->new("user is $user");
}
elsif (! defined $params{user}) {
diff --git a/IkiWiki/Plugin/filecheck.pm b/IkiWiki/Plugin/filecheck.pm
index 3b0a7b314..4f4e67489 100644
--- a/IkiWiki/Plugin/filecheck.pm
+++ b/IkiWiki/Plugin/filecheck.pm
@@ -161,7 +161,7 @@ sub match_mimetype ($$;@) {
}
my $regexp=IkiWiki::glob2re($wanted);
- if ($mimetype!~/^$regexp$/i) {
+ if ($mimetype!~$regexp) {
return IkiWiki::FailReason->new("file MIME type is $mimetype, not $wanted");
}
else {
diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm
index 5cfa72833..47007afe2 100644
--- a/IkiWiki/Plugin/meta.pm
+++ b/IkiWiki/Plugin/meta.pm
@@ -355,7 +355,7 @@ sub match {
}
if (defined $val) {
- if ($val=~/^$re$/i) {
+ if ($val=~$re) {
return IkiWiki::SuccessReason->new("$re matches $field of $page", $page => $IkiWiki::DEPEND_CONTENT, "" => 1);
}
else {
diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm
index a79e7d7f0..79142ed1f 100644
--- a/IkiWiki/Plugin/po.pm
+++ b/IkiWiki/Plugin/po.pm
@@ -1297,7 +1297,7 @@ sub match_lang ($$;@) {
my $regexp=IkiWiki::glob2re($wanted);
my $lang=IkiWiki::Plugin::po::lang($page);
- if ($lang !~ /^$regexp$/i) {
+ if ($lang !~ $regexp) {
return IkiWiki::FailReason->new("file language is $lang, not $wanted");
}
else {