aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/include
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2017-04-15 22:26:57 +0200
committerAnders Svensson <[email protected]>2017-06-12 16:13:52 +0200
commit836b02d325082063fc5887091bfc04db6afab181 (patch)
treee9259cb9a587927a2dd93f1833411e4adc6d3fc7 /lib/diameter/include
parentbcef012fe4a4534a9098b15ce42830b9a7a38db9 (diff)
downloadotp-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.
Diffstat (limited to 'lib/diameter/include')
-rw-r--r--lib/diameter/include/diameter_gen.hrl15
1 files changed, 7 insertions, 8 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,