aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2009-03-27 15:21:21 -0400
committerJoey Hess <joey@gnu.kitenet.net>2009-03-27 15:21:21 -0400
commitf9fd71df88e73d54f889eab48c16563d2d41f77d (patch)
tree149052cfcdd740567190cf2e755d45f0ba40faa2 /IkiWiki
parenta4ac48de10d8431691d090a3d82292313e2ed441 (diff)
downloadikiwiki-f9fd71df88e73d54f889eab48c16563d2d41f77d.tar
ikiwiki-f9fd71df88e73d54f889eab48c16563d2d41f77d.tar.gz
move dedup code into function, simplify
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/rename.pm15
1 files changed, 5 insertions, 10 deletions
diff --git a/IkiWiki/Plugin/rename.pm b/IkiWiki/Plugin/rename.pm
index d3ca8bd3a..de11e4cc9 100644
--- a/IkiWiki/Plugin/rename.pm
+++ b/IkiWiki/Plugin/rename.pm
@@ -319,14 +319,6 @@ sub sessioncgi ($$) {
session => $session,
);
- # remove duplicates from @torename
- my %seen=();
- my @uniq_torename;
- foreach my $item (@torename) {
- push(@uniq_torename, $item) unless $seen{$item->{src}}++;
- }
- @torename=@uniq_torename;
-
require IkiWiki::Render;
IkiWiki::disable_commit_hook() if $config{rcs};
my %origpagesources=%pagesources;
@@ -514,13 +506,16 @@ sub rename_hook (@) {
cgi => $q,
session => $session,
);
- return @torename;
+
+ # remove duplicates from @torename
+ my %seen;
+ return grep { ! $seen{$_->{src}}++ } @torename;
}
else {
return ();
}
}
-
+
sub do_rename ($$$) {
my $rename=shift;
my $q=shift;