aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp/src/manager
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/manager
parent0408e4af1978177d7dee498ea3dced37aa56aefe (diff)
downloadotp-827f952ce799f2051f60f0f8002d2e3908b2b5da.tar.gz
otp-827f952ce799f2051f60f0f8002d2e3908b2b5da.tar.bz2
otp-827f952ce799f2051f60f0f8002d2e3908b2b5da.zip
Rewrite ordering functions for maintainability
Diffstat (limited to 'lib/snmp/src/manager')
-rw-r--r--lib/snmp/src/manager/snmpm_config.erl19
1 files changed, 4 insertions, 15 deletions
diff --git a/lib/snmp/src/manager/snmpm_config.erl b/lib/snmp/src/manager/snmpm_config.erl
index 69a6b4a3a9..36c7b914ac 100644
--- a/lib/snmp/src/manager/snmpm_config.erl
+++ b/lib/snmp/src/manager/snmpm_config.erl
@@ -1783,21 +1783,10 @@ init_agent_config({UserId, TargetName, Config}) ->
-%% Sort tdomain first then port to ensure both comes before taddress
-order_agent({Item1, _}, {Item2, _}) ->
- if Item1 == Item2 ->
- true; % Item1 == Item2
- Item2 =:= tdomain ->
- false; % Item1 > tdomain
- Item2 =:= port ->
- if Item1 =:= tdomain ->
- true; % tdomain < port
- true ->
- false % Item1 > port
- end;
- true ->
- true % Item1 < Item 2
- end.
+%% Sort 'tdomain' first then 'port' to ensure both
+%% sorts before 'taddress'. Keep the order of other items.
+order_agent(ItemA, ItemB) ->
+ snmp_conf:keyorder(1, ItemA, ItemB, [tdomain, port]).
fix_agent_config(Conf) ->
?vdebug("fix_agent_config -> entry with~n~n"