optimise add_depends for simple pagespecs

We don't need to check if the pagespec is contentless; all simple ones are.
master
Joey Hess 2009-10-04 15:43:38 -04:00
parent 5fd230f968
commit daafdf1acb
1 changed files with 5 additions and 4 deletions

View File

@ -1771,18 +1771,19 @@ sub add_depends ($$;@) {
my $page=shift;
my $pagespec=shift;
my $simple=$pagespec =~ /$config{wiki_file_regexp}/ &&
$pagespec !~ /[\s*?()!]/;
my $deptype=$DEPEND_CONTENT | $DEPEND_EXISTS;
if (@_) {
my %params=@_;
if (defined $params{content} && $params{content} == 0 &&
pagespec_contentless($pagespec)) {
($simple || pagespec_contentless($pagespec))) {
$deptype=$deptype & ~$DEPEND_CONTENT;
}
}
if ($pagespec =~ /$config{wiki_file_regexp}/ &&
$pagespec !~ /[\s*?()!]/) {
# a simple dependency, which can be matched by string eq
if ($simple) {
$depends_simple{$page}{lc $pagespec} |= $deptype;
return 1;
}