diff options
author | Sverker Eriksson <[email protected]> | 2017-02-03 17:01:52 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2017-02-03 17:01:52 +0100 |
commit | 69b928b12d9206d00879c08e46143f599f9dc34e (patch) | |
tree | fde8905a6ca71c797725a33895321c67e81c3645 /lib/public_key/src | |
parent | 4b97d656a9e1774fd4ff984014f085ad661a4fdb (diff) | |
parent | 1923315e618bea9fb23fc3237541f95a0accc266 (diff) | |
download | otp-69b928b12d9206d00879c08e46143f599f9dc34e.tar.gz otp-69b928b12d9206d00879c08e46143f599f9dc34e.tar.bz2 otp-69b928b12d9206d00879c08e46143f599f9dc34e.zip |
Merge branch 'master' into sverker/enif_select
Diffstat (limited to 'lib/public_key/src')
-rw-r--r-- | lib/public_key/src/public_key.erl | 25 |
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; |