mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-20 16:15:59 +01:00
Convert code to use Fast YAML
This commit is contained in:
parent
b137ee3beb
commit
0de222d998
@ -252,7 +252,7 @@ start_apps() ->
|
||||
crypto:start(),
|
||||
ejabberd:start_app(sasl),
|
||||
ejabberd:start_app(ssl),
|
||||
ejabberd:start_app(p1_yaml),
|
||||
ejabberd:start_app(fast_yaml),
|
||||
ejabberd:start_app(p1_tls),
|
||||
ejabberd:start_app(p1_xml),
|
||||
ejabberd:start_app(stringprep),
|
||||
|
@ -162,7 +162,7 @@ convert_to_yaml(File, Output) ->
|
||||
fun({Host, Opts1}) ->
|
||||
{host_config, [{Host, Opts1}]}
|
||||
end, HOpts),
|
||||
Data = p1_yaml:encode(lists:reverse(NewOpts)),
|
||||
Data = fast_yaml:encode(lists:reverse(NewOpts)),
|
||||
case Output of
|
||||
stdout ->
|
||||
io:format("~s~n", [Data]);
|
||||
@ -226,14 +226,14 @@ get_plain_terms_file(File1, Opts) ->
|
||||
consult(File) ->
|
||||
case filename:extension(File) of
|
||||
Ex when (Ex == ".yml") or (Ex == ".yaml") ->
|
||||
case p1_yaml:decode_from_file(File, [plain_as_atom]) of
|
||||
case fast_yaml:decode_from_file(File, [plain_as_atom]) of
|
||||
{ok, []} ->
|
||||
{ok, []};
|
||||
{ok, [Document|_]} ->
|
||||
{ok, parserl(Document)};
|
||||
{error, Err} ->
|
||||
Msg1 = "Cannot load " ++ File ++ ": ",
|
||||
Msg2 = p1_yaml:format_error(Err),
|
||||
Msg2 = fast_yaml:format_error(Err),
|
||||
{error, Msg1 ++ Msg2}
|
||||
end;
|
||||
_ ->
|
||||
|
@ -589,10 +589,10 @@ rebar_dep({App, _, {git, Url, Ref}}) ->
|
||||
%% -- YAML spec parser
|
||||
|
||||
consult(File) ->
|
||||
case p1_yaml:decode_from_file(File, [plain_as_atom]) of
|
||||
case fast_yaml:decode_from_file(File, [plain_as_atom]) of
|
||||
{ok, []} -> {ok, []};
|
||||
{ok, [Doc|_]} -> {ok, [format(Spec) || Spec <- Doc]};
|
||||
{error, Err} -> {error, p1_yaml:format_error(Err)}
|
||||
{error, Err} -> {error, fast_yaml:format_error(Err)}
|
||||
end.
|
||||
|
||||
format({Key, Val}) when is_binary(Val) ->
|
||||
|
Loading…
Reference in New Issue
Block a user