mirror of
https://github.com/processone/ejabberd
synced 2025-10-03 09:49:18 +02:00
Avoid using the "else" conditional compilation macro directive
Even if "-else." is a valid directive: https://www.erlang.org/docs/28/system/macros.html#conditional-compilation there is a bug in rebar3_format that annoyingly rewrites it as "- else ." https://github.com/AdRoll/rebar3_format/issues/337 as a quick workaround, rewrite directives to not use "-else."
This commit is contained in:
parent
c51b044b3f
commit
38cc3ccb1e
3 changed files with 13 additions and 5 deletions
|
@ -1925,7 +1925,9 @@ lists_zipwith3(Combine, [E1 | List1], [E2 | List2], [], DefX, DefY, DefZ, Res) -
|
||||||
E123 = Combine(E1, E2, DefZ),
|
E123 = Combine(E1, E2, DefZ),
|
||||||
lists_zipwith3(Combine, List1, List2, [], DefX, DefY, DefZ, [E123 | Res]).
|
lists_zipwith3(Combine, List1, List2, [], DefX, DefY, DefZ, [E123 | Res]).
|
||||||
|
|
||||||
-else.
|
-endif.
|
||||||
|
|
||||||
|
-ifndef(OTP_BELOW_26).
|
||||||
|
|
||||||
lists_zipwith3(Combine, List1, List2, List3, How) ->
|
lists_zipwith3(Combine, List1, List2, List3, How) ->
|
||||||
lists:zipwith3(Combine, List1, List2, List3, How).
|
lists:zipwith3(Combine, List1, List2, List3, How).
|
||||||
|
|
|
@ -664,7 +664,9 @@ lists_zip3_pad([A | As], Nil, Nil, Xs) when (Nil == none) or (Nil == []) ->
|
||||||
lists_zip3_pad([], Nil, Nil, Xs) when (Nil == none) or (Nil == []) ->
|
lists_zip3_pad([], Nil, Nil, Xs) when (Nil == none) or (Nil == []) ->
|
||||||
lists:reverse(Xs).
|
lists:reverse(Xs).
|
||||||
|
|
||||||
-else.
|
-endif.
|
||||||
|
|
||||||
|
-ifndef(OTP_BELOW_26).
|
||||||
|
|
||||||
lists_zip3_pad(As, Bs, Cs) ->
|
lists_zip3_pad(As, Bs, Cs) ->
|
||||||
lists:zip3(As, Bs, Cs, {pad, {error_missing_args_def, "", ""}}).
|
lists:zip3(As, Bs, Cs, {pad, {error_missing_args_def, "", ""}}).
|
||||||
|
|
|
@ -11,7 +11,6 @@ encode_binary_test() ->
|
||||||
Encoded = <<"\"This is an error text.\"">>,
|
Encoded = <<"\"This is an error text.\"">>,
|
||||||
?assertMatch(Encoded, misc:json_encode(Binary)).
|
?assertMatch(Encoded, misc:json_encode(Binary)).
|
||||||
|
|
||||||
-ifdef(OTP_BELOW_27).
|
|
||||||
-ifdef(OTP_BELOW_26).
|
-ifdef(OTP_BELOW_26).
|
||||||
|
|
||||||
%% OTP 25 or lower
|
%% OTP 25 or lower
|
||||||
|
@ -24,7 +23,11 @@ encode_map_test() ->
|
||||||
<<"{\"service\":\"conference\",\"name\":\"room\",\"jid\":\"user@server\",\"affiliation\":\"member\"}">>,
|
<<"{\"service\":\"conference\",\"name\":\"room\",\"jid\":\"user@server\",\"affiliation\":\"member\"}">>,
|
||||||
?assertMatch(Encoded, misc:json_encode(Map)).
|
?assertMatch(Encoded, misc:json_encode(Map)).
|
||||||
|
|
||||||
-else.
|
-endif.
|
||||||
|
|
||||||
|
-ifdef(OTP_BELOW_27).
|
||||||
|
|
||||||
|
-ifndef(OTP_BELOW_26).
|
||||||
|
|
||||||
%% OTP 26
|
%% OTP 26
|
||||||
encode_map_test() ->
|
encode_map_test() ->
|
||||||
|
@ -37,8 +40,9 @@ encode_map_test() ->
|
||||||
?assertMatch(Encoded, misc:json_encode(Map)).
|
?assertMatch(Encoded, misc:json_encode(Map)).
|
||||||
|
|
||||||
-endif.
|
-endif.
|
||||||
|
-endif.
|
||||||
|
|
||||||
-else.
|
-ifndef(OTP_BELOW_27).
|
||||||
|
|
||||||
%% OTP 27 or higher or higher
|
%% OTP 27 or higher or higher
|
||||||
encode_map_test() ->
|
encode_map_test() ->
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue