aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2012-11-22 15:46:41 +0100
committerBjörn Gustavsson <[email protected]>2012-11-26 11:12:59 +0100
commit66ae461376c17806b25b8165d8ff86782fbacfa6 (patch)
treed35c1f301576c20a6f364f29bb51f2ff8cfc3c7b /lib/asn1
parent556879a3d8c4dfa611b9c2444b9e9e77b9ec4e49 (diff)
downloadotp-66ae461376c17806b25b8165d8ff86782fbacfa6.tar.gz
otp-66ae461376c17806b25b8165d8ff86782fbacfa6.tar.bz2
otp-66ae461376c17806b25b8165d8ff86782fbacfa6.zip
Simplify the code for the generated info/0 function
While at it, also make the generated code for the attributes more readable.
Diffstat (limited to 'lib/asn1')
-rw-r--r--lib/asn1/src/asn1ct_gen.erl25
1 files changed, 11 insertions, 14 deletions
diff --git a/lib/asn1/src/asn1ct_gen.erl b/lib/asn1/src/asn1ct_gen.erl
index 6f09ff07d8..b0990e92cf 100644
--- a/lib/asn1/src/asn1ct_gen.erl
+++ b/lib/asn1/src/asn1ct_gen.erl
@@ -1107,19 +1107,16 @@ gen_dispatcher([Flast|_T],FuncName,Prefix,ExtraArg) ->
pgen_info() ->
emit(["info() ->",nl,
- " case ?MODULE:module_info() of",nl,
- " MI when is_list(MI) ->",nl,
- " case lists:keysearch(attributes,1,MI) of",nl,
- " {value,{_,Attributes}} when is_list(Attributes) ->",nl,
- " case lists:keysearch(asn1_info,1,Attributes) of",nl,
- " {value,{_,Info}} when is_list(Info) ->",nl,
- " Info;",nl,
- " _ ->",nl,
- " []",nl,
- " end;",nl,
- " _ ->",nl,
- " []",nl,
- " end",nl,
+ " case ?MODULE:module_info(attributes) of",nl,
+ " Attributes when is_list(Attributes) ->",nl,
+ " case lists:keyfind(asn1_info, 1, Attributes) of",nl,
+ " {_,Info} when is_list(Info) ->",nl,
+ " Info;",nl,
+ " _ ->",nl,
+ " []",nl,
+ " end;",nl,
+ " _ ->",nl,
+ " []",nl,
" end.",nl]).
open_hrl(OutFile,Module) ->
@@ -1418,7 +1415,7 @@ gen_head(Erules,Mod,Hrl) ->
emit(["-define('",Rtmac,"',",Rtmod,").",nl]),
emit(["-asn1_info([{vsn,'",asn1ct:vsn(),"'},",nl,
" {module,'",Mod,"'},",nl,
- " {options,",io_lib:format("~w",[Options]),"}]).",nl,nl]).
+ " {options,",io_lib:format("~p",[Options]),"}]).",nl,nl]).
gen_hrlhead(Mod) ->