diff options
author | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-04-22 20:02:17 +0200 |
---|---|---|
committer | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-04-22 20:02:17 +0200 |
commit | 271477d8c26794abd8310e2abb89b746204660af (patch) | |
tree | a4701a52f9ff1918e25a75e09267bfba0b063296 /Bugzilla/DB | |
parent | 3417cb73db6d2306a012d3c624e9bec92fa1a161 (diff) | |
download | bugzilla-271477d8c26794abd8310e2abb89b746204660af.tar.gz bugzilla-271477d8c26794abd8310e2abb89b746204660af.tar.xz |
Bug 560009: Use firstidx from List::MoreUtils instead of lsearch
r=timello, a=mkanat
Diffstat (limited to 'Bugzilla/DB')
-rw-r--r-- | Bugzilla/DB/Schema.pm | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Bugzilla/DB/Schema.pm b/Bugzilla/DB/Schema.pm index 6520766f3..8e0458a51 100644 --- a/Bugzilla/DB/Schema.pm +++ b/Bugzilla/DB/Schema.pm @@ -44,6 +44,7 @@ use Bugzilla::Constants; use Carp qw(confess); use Digest::MD5 qw(md5_hex); use Hash::Util qw(lock_value unlock_hash lock_keys unlock_keys); +use List::MoreUtils qw(firstidx); use Safe; # Historical, needed for SCHEMA_VERSION = '1.00' use Storable qw(dclone freeze thaw); @@ -2451,7 +2452,7 @@ sub delete_column { my ($self, $table, $column) = @_; my $abstract_fields = $self->{abstract_schema}{$table}{FIELDS}; - my $name_position = lsearch($abstract_fields, $column); + my $name_position = firstidx { $_ eq $column } @$abstract_fields; die "Attempted to delete nonexistent column ${table}.${column}" if $name_position == -1; # Delete the key/value pair from the array. @@ -2540,7 +2541,7 @@ sub set_index { sub _set_object { my ($self, $table, $name, $definition, $array_to_change) = @_; - my $obj_position = lsearch($array_to_change, $name) + 1; + my $obj_position = (firstidx { $_ eq $name } @$array_to_change) + 1; # If the object doesn't exist, then add it. if (!$obj_position) { push(@$array_to_change, $name); @@ -2573,7 +2574,7 @@ sub delete_index { my ($self, $table, $name) = @_; my $indexes = $self->{abstract_schema}{$table}{INDEXES}; - my $name_position = lsearch($indexes, $name); + my $name_position = firstidx { $_ eq $name } @$indexes; die "Attempted to delete nonexistent index $name on the $table table" if $name_position == -1; # Delete the key/value pair from the array. |