25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-30 16:36:29 +01:00

Prevent Dialyzer warnings about case inside macro

This commit is contained in:
Badlop 2010-07-02 23:38:22 +02:00
parent c89944fe12
commit 894f0abdfa

View File

@ -3145,12 +3145,15 @@ set_config(XEl, StateData) ->
end end
end. end.
-define(SET_BOOL_XOPT_FALSE(Opt), set_xoption(Opts, Config#config{Opt = false})).
-define(SET_BOOL_XOPT_TRUE (Opt), set_xoption(Opts, Config#config{Opt = true})).
-define(SET_BOOL_XOPT(Opt, Val), -define(SET_BOOL_XOPT(Opt, Val),
case Val of case Val of
"0" -> set_xoption(Opts, Config#config{Opt = false}); "0" -> ?SET_BOOL_XOPT_FALSE(Opt);
"false" -> set_xoption(Opts, Config#config{Opt = false}); "false" -> ?SET_BOOL_XOPT_FALSE(Opt);
"1" -> set_xoption(Opts, Config#config{Opt = true}); "1" -> ?SET_BOOL_XOPT_TRUE(Opt);
"true" -> set_xoption(Opts, Config#config{Opt = true}); "true" -> ?SET_BOOL_XOPT_TRUE(Opt);
_ -> {error, 'bad-request'} _ -> {error, 'bad-request'}
end). end).
@ -3208,9 +3211,9 @@ set_xoption([{"anonymous", [Val]} | Opts], Config) ->
set_xoption([{"muc#roomconfig_whois", [Val]} | Opts], Config) -> set_xoption([{"muc#roomconfig_whois", [Val]} | Opts], Config) ->
case Val of case Val of
"moderators" -> "moderators" ->
?SET_BOOL_XOPT(anonymous, "1"); ?SET_BOOL_XOPT_TRUE(anonymous);
"anyone" -> "anyone" ->
?SET_BOOL_XOPT(anonymous, "0"); ?SET_BOOL_XOPT_FALSE(anonymous);
_ -> _ ->
{error, 'bad-request'} {error, 'bad-request'}
end; end;