diff options
author | Joey Hess <joey@kitenet.net> | 2010-11-20 12:25:52 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-11-20 12:25:52 -0400 |
commit | b3bca318ef11ce9d0609d952a72849243b591b9d (patch) | |
tree | d81d596b4ab0e7a00ca04cbd999381c6ae894937 | |
parent | cfbfbdc5979abc941b08862bd1f66bc986e9ac08 (diff) |
avoid an unnecessary hash lookup
-rw-r--r-- | IkiWiki.pm | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm index e5370f4a6..f57ef8c6c 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -2493,11 +2493,11 @@ sub match_glob ($$;@) { # Instead of converting the glob to a regex every time, # cache the compiled regex to save time. - if (!defined $glob_cache{$glob}) { - my $re = IkiWiki::glob2re($glob); - $glob_cache{$glob} = $re; + my $re=$glob_cache{$glob}; + unless (defined $re) { + $glob_cache{$glob} = $re = IkiWiki::glob2re($glob); } - if ($page=~ $glob_cache{$glob}) { + if ($page =~ $re) { if (! IkiWiki::isinternal($page) || $params{internal}) { return IkiWiki::SuccessReason->new("$glob matches $page"); } |