aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public_key/src/public_key.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public_key/src/public_key.erl')
-rw-r--r--lib/public_key/src/public_key.erl25
1 files changed, 11 insertions, 14 deletions
diff --git a/lib/public_key/src/public_key.erl b/lib/public_key/src/public_key.erl
index fed3b09f36..3d6238d998 100644
--- a/lib/public_key/src/public_key.erl
+++ b/lib/public_key/src/public_key.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2015. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2016. 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.
@@ -1029,19 +1029,16 @@ do_pkix_crls_validate(OtpCert, [{DP, CRL, DeltaCRL} | Rest], All, Options, Revo
end.
sort_dp_crls(DpsAndCrls, FreshCB) ->
- Sorted = do_sort_dp_crls(DpsAndCrls, dict:new()),
- sort_crls(Sorted, FreshCB, []).
-
-do_sort_dp_crls([], Dict) ->
- dict:to_list(Dict);
-do_sort_dp_crls([{DP, CRL} | Rest], Dict0) ->
- Dict = try dict:fetch(DP, Dict0) of
- _ ->
- dict:append(DP, CRL, Dict0)
- catch _:_ ->
- dict:store(DP, [CRL], Dict0)
- end,
- do_sort_dp_crls(Rest, Dict).
+ sort_crls(maps:to_list(lists:foldl(fun group_dp_crls/2,
+ #{},
+ DpsAndCrls)),
+ FreshCB, []).
+
+group_dp_crls({DP,CRL}, M) ->
+ case M of
+ #{DP := CRLs} -> M#{DP := [CRL|CRLs]};
+ _ -> M#{DP => [CRL]}
+ end.
sort_crls([], _, Acc) ->
Acc;