diff options
author | Anders Svensson <[email protected]> | 2017-04-15 22:26:57 +0200 |
---|---|---|
committer | Anders Svensson <[email protected]> | 2017-06-12 16:13:52 +0200 |
commit | 836b02d325082063fc5887091bfc04db6afab181 (patch) | |
tree | e9259cb9a587927a2dd93f1833411e4adc6d3fc7 | |
parent | bcef012fe4a4534a9098b15ce42830b9a7a38db9 (diff) | |
download | otp-836b02d325082063fc5887091bfc04db6afab181.tar.gz otp-836b02d325082063fc5887091bfc04db6afab181.tar.bz2 otp-836b02d325082063fc5887091bfc04db6afab181.zip |
Use maps when detecting missing AVPs
Instead of the slower sets. Bump application dependencies to 17.5, even
though earlier versions may do fine.
-rw-r--r-- | lib/diameter/include/diameter_gen.hrl | 15 | ||||
-rw-r--r-- | lib/diameter/src/diameter.app.src | 10 |
2 files changed, 12 insertions, 13 deletions
diff --git a/lib/diameter/include/diameter_gen.hrl b/lib/diameter/include/diameter_gen.hrl index dd8c720e68..f7d432912d 100644 --- a/lib/diameter/include/diameter_gen.hrl +++ b/lib/diameter/include/diameter_gen.hrl @@ -209,15 +209,15 @@ newrec(Name) -> missing(Rec, Name, Failed) -> Avps = lists:foldl(fun({_, #diameter_avp{code = C, vendor_id = V}}, A) -> - sets:add_element({C,V}, A) + maps:put({C,V}, true, A) end, - sets:new(), + maps:new(), Failed), [{5005, A} || F <- '#info-'(element(1, Rec), fields), not has_arity(avp_arity(Name, F), '#get-'(F, Rec)), - #diameter_avp{code = C, vendor_id = V} - = A <- [empty_avp(F)], - not sets:is_element({C,V}, Avps)]. + {C,_,V} = H <- [avp_header(F)], + not maps:is_key({C,V}, Avps), + A <- [empty_avp(F,H)]]. %% Maximum arities have already been checked in building the record. @@ -235,10 +235,9 @@ has_prefix(_, []) -> has_prefix(N, L) -> has_prefix(N-1, tl(L)). -%% empty_avp/1 +%% empty_avp/2 -empty_avp(Name) -> - {Code, Flags, VId} = avp_header(Name), +empty_avp(Name, {Code, Flags, VId}) -> {Name, Type} = avp_name(Code, VId), #diameter_avp{name = Name, code = Code, diff --git a/lib/diameter/src/diameter.app.src b/lib/diameter/src/diameter.app.src index d380ebbd92..9a6e47006b 100644 --- a/lib/diameter/src/diameter.app.src +++ b/lib/diameter/src/diameter.app.src @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2010-2016. All Rights Reserved. +%% Copyright Ericsson AB 2010-2017. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -28,10 +28,10 @@ ]}, {registered, [%REGISTERED%]}, {applications, [ - {stdlib, "2.0"}, {kernel, "3.0"}%, {erts, "6.0"} - %% {syntax-tools, "1.6.14"} - %% {runtime-tools, "1.8.14"} - %, {ssl, "5.3.4"} + {stdlib, "2.4"}, {kernel, "3.2"}%, {erts, "6.4"} + %% {syntax-tools, "1.6,18"} + %% {runtime-tools, "1.8.16"} + %, {ssl, "6.0"} ]}, {env, []}, {mod, {diameter_app, []}}, |