summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2009-03-27 15:23:36 -0400
committerJoey Hess <joey@gnu.kitenet.net>2009-03-27 15:23:36 -0400
commit529a06b7cc4991f6e78fc59855398f986d2dc21e (patch)
tree9bffa431a02374ef7df335b5b6982b549e142b8f /IkiWiki/Plugin
parentf9fd71df88e73d54f889eab48c16563d2d41f77d (diff)
simplifiy
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/rename.pm47
1 files changed, 22 insertions, 25 deletions
diff --git a/IkiWiki/Plugin/rename.pm b/IkiWiki/Plugin/rename.pm
index de11e4cc9..09250af81 100644
--- a/IkiWiki/Plugin/rename.pm
+++ b/IkiWiki/Plugin/rename.pm
@@ -486,34 +486,31 @@ sub rename_hook (@) {
my $q=$params{cgi};
my $session=$params{session};
+ return () unless @torename;
+
my @nextset;
- if (@torename) {
- foreach my $torename (@torename) {
- unless (exists $done{$torename->{src}} && $done{$torename->{src}}) {
- IkiWiki::run_hooks(rename => sub {
- push @nextset, shift->(
- torename => $torename,
- cgi => $q,
- session => $session,
- );
- });
- $done{$torename->{src}}=1;
- }
+ foreach my $torename (@torename) {
+ unless (exists $done{$torename->{src}} && $done{$torename->{src}}) {
+ IkiWiki::run_hooks(rename => sub {
+ push @nextset, shift->(
+ torename => $torename,
+ cgi => $q,
+ session => $session,
+ );
+ });
+ $done{$torename->{src}}=1;
}
- push @torename, rename_hook(
- torename => \@nextset,
- done => \%done,
- cgi => $q,
- session => $session,
- );
-
- # remove duplicates from @torename
- my %seen;
- return grep { ! $seen{$_->{src}}++ } @torename;
- }
- else {
- return ();
}
+ push @torename, rename_hook(
+ torename => \@nextset,
+ done => \%done,
+ cgi => $q,
+ session => $session,
+ );
+
+ # dedup
+ my %seen;
+ return grep { ! $seen{$_->{src}}++ } @torename;
}
sub do_rename ($$$) {