diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2018-07-07 06:25:54 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2018-07-07 06:25:54 +0000 |
commit | 0f13724e6a584f43430b4459cdebf41d9b6e0904 (patch) | |
tree | 1ef095d29ac3935a09387983626c72f0ab0765c0 /usr.sbin/pkg_add | |
parent | 68b892e4153355dc52dcadebd8da5210f5aa2024 (diff) |
what was I thinking. No need to iterate, just use the key
and avoid a stupid bug where we leave the iterator mid-range
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Dependencies/SolverBase.pm | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Dependencies/SolverBase.pm b/usr.sbin/pkg_add/OpenBSD/Dependencies/SolverBase.pm index 264a471c285..f0ce4f00864 100644 --- a/usr.sbin/pkg_add/OpenBSD/Dependencies/SolverBase.pm +++ b/usr.sbin/pkg_add/OpenBSD/Dependencies/SolverBase.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: SolverBase.pm,v 1.9 2018/07/01 08:24:20 espie Exp $ +# $OpenBSD: SolverBase.pm,v 1.10 2018/07/07 06:25:53 espie Exp $ # # Copyright (c) 2005-2018 Marc Espie <espie@openbsd.org> # @@ -432,16 +432,12 @@ sub find_dep_in_self sub find_in_self { my ($solver, $plist, $state, $tag) = @_; - return 0 unless defined $plist->{tags_definitions}; - while (my ($name, $d) = each %{$plist->{tags_definitions}}) { - next unless $tag->name eq $name; - $tag->{definition_list} = $d; - $tag->{found_in_self} = 1; - $state->say("Found tag #1 in self", $tag->stringize) - if $state->verbose >= 3; - return 1; - } - return 0; + return 0 unless defined $plist->{tags_definitions}{$tag->name}; + $tag->{definition_list} = $plist->{tags_definitions}{$tag->name}; + $tag->{found_in_self} = 1; + $state->say("Found tag #1 in self", $tag->stringize) + if $state->verbose >= 3; + return 1; } use OpenBSD::PackageInfo; |