aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp/src/agent
diff options
context:
space:
mode:
authorRaimo Niskanen <[email protected]>2014-05-22 10:06:51 +0200
committerRaimo Niskanen <[email protected]>2014-07-25 12:17:49 +0200
commit827f952ce799f2051f60f0f8002d2e3908b2b5da (patch)
treef5b7f55bd2c1b5428994867842a9356730553df7 /lib/snmp/src/agent
parent0408e4af1978177d7dee498ea3dced37aa56aefe (diff)
downloadotp-827f952ce799f2051f60f0f8002d2e3908b2b5da.tar.gz
otp-827f952ce799f2051f60f0f8002d2e3908b2b5da.tar.bz2
otp-827f952ce799f2051f60f0f8002d2e3908b2b5da.zip
Rewrite ordering functions for maintainability
Diffstat (limited to 'lib/snmp/src/agent')
-rw-r--r--lib/snmp/src/agent/snmp_framework_mib.erl12
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/snmp/src/agent/snmp_framework_mib.erl b/lib/snmp/src/agent/snmp_framework_mib.erl
index 6589ace949..43c91bbbc8 100644
--- a/lib/snmp/src/agent/snmp_framework_mib.erl
+++ b/lib/snmp/src/agent/snmp_framework_mib.erl
@@ -222,15 +222,9 @@ check_agent(X) ->
error({invalid_agent_attribute, X}).
%% Ordering function to sort intAgentTransportDomain first
-%% hence before intAgentIpAddress
-order_agent({Name, _}, {Name, _}) ->
- true; %% Less than or equal
-order_agent({_, _}, {intAgentTransportDomain, _}) ->
- false; %% Greater than
-order_agent({intAgentTransportDomain, _}, {_, _}) ->
- true; %% Less than or equal
-order_agent({A, _}, {B, _}) ->
- A =< B.
+%% hence before intAgentIpAddress. Sort other entries on the key.
+order_agent(EntryA, EntryB) ->
+ snmp_conf:keyorder(1, EntryA, EntryB, [intAgentTransportDomain | sort]).