diff options
author | Martijn van Duren <martijn@cvs.openbsd.org> | 2023-11-12 20:10:14 +0000 |
---|---|---|
committer | Martijn van Duren <martijn@cvs.openbsd.org> | 2023-11-12 20:10:14 +0000 |
commit | 6e2a3a174efcaa0e0fb0d6faebe39e00eed40874 (patch) | |
tree | 1b6cda55b7383fec747b408e39043b876679a958 /usr.sbin/snmpd | |
parent | 4bba62cbdb4fa05656c79b54394d866c682fbb5b (diff) |
Now that smi_oid_cmp() is only used by the oidtree RB-tree, and nothing
fancy is using it, we can simply rely on ober_oid_cmp().
OK tb@
Diffstat (limited to 'usr.sbin/snmpd')
-rw-r--r-- | usr.sbin/snmpd/smi.c | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/usr.sbin/snmpd/smi.c b/usr.sbin/snmpd/smi.c index 423bf5c2590..f895f41e6ee 100644 --- a/usr.sbin/snmpd/smi.c +++ b/usr.sbin/snmpd/smi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smi.c,v 1.35 2023/11/12 20:07:48 martijn Exp $ */ +/* $OpenBSD: smi.c,v 1.36 2023/11/12 20:10:13 martijn Exp $ */ /* * Copyright (c) 2007, 2008 Reyk Floeter <reyk@openbsd.org> @@ -48,8 +48,6 @@ #include "mib.h" #include "application.h" -#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b)) - RB_HEAD(oidtree, oid); RB_PROTOTYPE(oidtree, oid, o_element, smi_oid_cmp); struct oidtree smi_oidtree; @@ -694,23 +692,7 @@ smi_application(struct ber_element *elm) int smi_oid_cmp(struct oid *a, struct oid *b) { - size_t i; - - for (i = 0; i < MINIMUM(a->o_oidlen, b->o_oidlen); i++) - if (a->o_oid[i] != b->o_oid[i]) - return (a->o_oid[i] - b->o_oid[i]); - - /* - * Return success if the matched object is a table - * or a MIB registered by a subagent - * (it will match any sub-elements) - */ - if (b->o_flags & OID_TABLE && - (a->o_flags & OID_KEY) == 0 && - (a->o_oidlen > b->o_oidlen)) - return (0); - - return (a->o_oidlen - b->o_oidlen); + return ober_oid_cmp(&a->o_id, &b->o_id); } RB_GENERATE(oidtree, oid, o_element, smi_oid_cmp); |