summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD/LibSpec.pm
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD/LibSpec.pm')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/LibSpec.pm28
1 files changed, 13 insertions, 15 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/LibSpec.pm b/usr.sbin/pkg_add/OpenBSD/LibSpec.pm
index acc9ffbbee2..9fcfcd9f57c 100644
--- a/usr.sbin/pkg_add/OpenBSD/LibSpec.pm
+++ b/usr.sbin/pkg_add/OpenBSD/LibSpec.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: LibSpec.pm,v 1.17 2017/02/10 02:10:22 espie Exp $
+# $OpenBSD: LibSpec.pm,v 1.18 2017/09/16 12:04:13 espie Exp $
#
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
#
@@ -20,7 +20,6 @@ use warnings;
package OpenBSD::LibObject;
-
sub key
{
my $self = shift;
@@ -81,6 +80,18 @@ sub lookup
return $r;
}
+sub compare
+{
+ my ($a, $b) = @_;
+ if ($a->key ne $b->key) {
+ return $a->key cmp $b->key;
+ }
+ if ($a->major != $b->major) {
+ return $a->major <=> $b->major;
+ }
+ return $a->minor <=> $b->minor;
+}
+
package OpenBSD::BadLib;
our @ISA=qw(OpenBSD::LibObject);
@@ -305,17 +316,4 @@ sub match
return !$spec->no_match($library, $base);
}
-sub compare
-{
- my ($a, $b) = @_;
-
- if ($a->key ne $b->key) {
- return undef;
- }
- if ($a->major != $b->major) {
- return $a->major <=> $b->major;
- }
- return $a->minor <=> $b->minor;
-}
-
1;