aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src/base
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2013-02-02 00:51:02 +0100
committerAnders Svensson <[email protected]>2013-02-08 19:28:47 +0100
commit2e422db2bf236fb5369cbfe54b6ccd727703b801 (patch)
tree6e9adda0f914888f7d6d692e60d266ef323db205 /lib/diameter/src/base
parent61f9d7326380e7cf20c539e548cb4cbab2109b2a (diff)
downloadotp-2e422db2bf236fb5369cbfe54b6ccd727703b801.tar.gz
otp-2e422db2bf236fb5369cbfe54b6ccd727703b801.tar.bz2
otp-2e422db2bf236fb5369cbfe54b6ccd727703b801.zip
Add exprecs '#get-'/1 for transforming records into lists
The generated '#get-'/1 has one clause for each exported record r, whose definition is equivalent to the following. '#get-'(#r{} = Rec) -> [r | lists:zip(record_info(r, fields), tl(tuple_to_list(Rec)))]; The record name at the head of the list is the same format that diameter accepts for outgoing message.
Diffstat (limited to 'lib/diameter/src/base')
-rw-r--r--lib/diameter/src/base/diameter_capx.erl12
1 files changed, 2 insertions, 10 deletions
diff --git a/lib/diameter/src/base/diameter_capx.erl b/lib/diameter/src/base/diameter_capx.erl
index 9efe28b9e0..715b15628c 100644
--- a/lib/diameter/src/base/diameter_capx.erl
+++ b/lib/diameter/src/base/diameter_capx.erl
@@ -282,17 +282,9 @@ cs(LS, RS) ->
%% CER is a subset of CEA, the latter adding Result-Code and a few
%% more AVP's.
cea_from_cer(CER, Dict) ->
- lists:foldl(fun(F,A) -> to_cea(CER, F, A, Dict) end,
- Dict:'#new-'(diameter_base_CEA),
- Dict:'#info-'(diameter_base_CER, fields)).
+ [diameter_base_CER | Values] = Dict:'#get-'(CER),
+ Dict:'#set-'(Values, Dict:'#new-'(diameter_base_CEA)).
-to_cea(CER, Field, CEA, Dict) ->
- try Dict:'#get-'(Field, CER) of
- V -> Dict:'#set-'({Field, V}, CEA)
- catch
- error: _ -> CEA
- end.
-
%% rCEA/3
rCEA(CEA, #diameter_service{capabilities = LCaps} = Svc, Dict) ->