From 49449152d181d37f554a1b6e44836384d3c54b3d Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Tue, 27 Jun 2006 17:54:04 +0000 Subject: Bug 342749: Replace Bugzilla::Util's min and max with the List::Util equivalents Patch By Max Kanat-Alexander r=colin.ogilvie, r=vladd, a=justdave --- Bugzilla/Bug.pm | 2 ++ Bugzilla/Chart.pm | 5 +++-- Bugzilla/Util.pm | 28 +--------------------------- 3 files changed, 6 insertions(+), 29 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index 8be6705ef..8b6302b92 100755 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -43,6 +43,8 @@ use Bugzilla::Util; use Bugzilla::Error; use Bugzilla::Product; +use List::Util qw(min); + use base qw(Exporter); @Bugzilla::Bug::EXPORT = qw( AppendComment ValidateComment diff --git a/Bugzilla/Chart.pm b/Bugzilla/Chart.pm index b2db9da30..729120e8e 100644 --- a/Bugzilla/Chart.pm +++ b/Bugzilla/Chart.pm @@ -38,6 +38,7 @@ use Bugzilla::Series; use Date::Format; use Date::Parse; +use List::Util qw(max); sub new { my $invocant = shift; @@ -313,10 +314,10 @@ sub readData { my $datediff = shift @datediff_total; push @processed_datediff, $datediff if defined($datediff); } - $self->{'y_max_value'} = Bugzilla::Util::max(@processed_datediff); + $self->{'y_max_value'} = max(@processed_datediff); } else { - $self->{'y_max_value'} = Bugzilla::Util::max(@maxvals); + $self->{'y_max_value'} = max(@maxvals); } $self->{'y_max_value'} |= 1; # For log() diff --git a/Bugzilla/Util.pm b/Bugzilla/Util.pm index 6660fff91..c5cfc0444 100644 --- a/Bugzilla/Util.pm +++ b/Bugzilla/Util.pm @@ -35,7 +35,7 @@ use base qw(Exporter); html_quote url_quote value_quote xml_quote css_class_quote i_am_cgi get_netaddr - lsearch max min + lsearch diff_arrays diff_strings trim wrap_comment find_wrap_point perform_substs @@ -158,22 +158,6 @@ sub lsearch { return -1; } -sub max { - my $max = shift(@_); - foreach my $val (@_) { - $max = $val if $val > $max; - } - return $max; -} - -sub min { - my $min = shift(@_); - foreach my $val (@_) { - $min = $val if $val < $min; - } - return $min; -} - sub diff_arrays { my ($old_ref, $new_ref) = @_; @@ -450,8 +434,6 @@ Bugzilla::Util - Generic utility functions for bugzilla # Functions for searching $loc = lsearch(\@arr, $val); - $val = max($a, $b, $c); - $val = min($a, $b, $c); # Data manipulation ($removed, $added) = diff_arrays(\@old, \@new); @@ -598,14 +580,6 @@ reference. If the item is not in the list, returns -1. -=item C - -Returns the maximum from a set of values. - -=item C - -Returns the minimum from a set of values. - =back =head2 Data Manipulation -- cgit v1.2.3-24-g4f1b