]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
avoid an unnecessary hash lookup
authorJoey Hess <joey@kitenet.net>
Sat, 20 Nov 2010 16:25:52 +0000 (12:25 -0400)
committerJoey Hess <joey@kitenet.net>
Sat, 20 Nov 2010 16:25:52 +0000 (12:25 -0400)
IkiWiki.pm

index e5370f4a6577f736ca869c84f19d260caf518b6c..f57ef8c6c89d169cf8523d5f588b939f62d8d540 100644 (file)
@@ -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");
                }