aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src/compiler
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2011-08-24 16:53:13 +0200
committerAnders Svensson <[email protected]>2011-08-24 16:53:13 +0200
commitf7250e531db57154f77d1e37d7a317d1bd18b616 (patch)
tree436c3eed8bad65e29b0d4136cda2e1108baa2666 /lib/diameter/src/compiler
parent3536111957c809976ed3e7091e85960990be904d (diff)
parent46bcbf8b8c5e53d3b9aaa1be987947fc0b927f8d (diff)
downloadotp-f7250e531db57154f77d1e37d7a317d1bd18b616.tar.gz
otp-f7250e531db57154f77d1e37d7a317d1bd18b616.tar.bz2
otp-f7250e531db57154f77d1e37d7a317d1bd18b616.zip
Merge branch 'anders/diameter/optional_appid_in_spec/OTP-9467' into dev
* anders/diameter/optional_appid_in_spec/OTP-9467: @id required in dictionary files only when @messages is specified.
Diffstat (limited to 'lib/diameter/src/compiler')
-rw-r--r--lib/diameter/src/compiler/diameter_codegen.erl17
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/diameter/src/compiler/diameter_codegen.erl b/lib/diameter/src/compiler/diameter_codegen.erl
index 213ba0d22c..6895f38248 100644
--- a/lib/diameter/src/compiler/diameter_codegen.erl
+++ b/lib/diameter/src/compiler/diameter_codegen.erl
@@ -250,9 +250,14 @@ f_name(Name) ->
%%% ------------------------------------------------------------------------
f_id(Spec) ->
- Id = orddict:fetch(id, Spec),
{?function, id, 0,
- [{?clause, [], [], [?INTEGER(Id)]}]}.
+ [c_id(orddict:find(id, Spec))]}.
+
+c_id({ok, Id}) ->
+ {?clause, [], [], [?INTEGER(Id)]};
+
+c_id(error) ->
+ ?UNEXPECTED(0).
%%% ------------------------------------------------------------------------
%%% # vendor_id/0
@@ -537,10 +542,14 @@ f_msg_header(Spec) ->
{?function, msg_header, 1, msg_header(Spec) ++ [?UNEXPECTED(1)]}.
msg_header(Spec) ->
+ msg_header(get_value(messages, Spec), Spec).
+
+msg_header([], _) ->
+ [];
+msg_header(Msgs, Spec) ->
ApplId = orddict:fetch(id, Spec),
- lists:map(fun({M,C,F,_,_}) -> c_msg_header(M, C, F, ApplId) end,
- get_value(messages, Spec)).
+ lists:map(fun({M,C,F,_,_}) -> c_msg_header(M, C, F, ApplId) end, Msgs).
%% Note that any application id in the message header spec is ignored.