25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-06 16:42:56 +01:00

Do not check for deprecated types

Since we support only Erlang >= OTP-17.5, the check for old-style
dict/queue/etc types is no longer needed
This commit is contained in:
Evgeniy Khramtsov 2018-06-14 18:58:35 +03:00
parent 141be53c21
commit 49b08949b1
11 changed files with 16 additions and 77 deletions

View File

@ -275,8 +275,6 @@ if test "$ENABLEGROUP" != ""; then
AC_SUBST([INSTALLGROUP], [$ENABLEGROUP])
fi
ERLANG_DEPRECATED_TYPES_CHECK
if test "$sqlite" = "true"; then
AX_LIB_SQLITE3([3.6.19])
if test "x$SQLITE3_VERSION" = "x"; then

View File

@ -1,35 +0,0 @@
%%%----------------------------------------------------------------------
%%%
%%% ejabberd, Copyright (C) 2002-2018 ProcessOne
%%%
%%% This program is free software; you can redistribute it and/or
%%% modify it under the terms of the GNU General Public License as
%%% published by the Free Software Foundation; either version 2 of the
%%% License, or (at your option) any later version.
%%%
%%% This program is distributed in the hope that it will be useful,
%%% but WITHOUT ANY WARRANTY; without even the implied warranty of
%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
%%% General Public License for more details.
%%%
%%% You should have received a copy of the GNU General Public License along
%%% with this program; if not, write to the Free Software Foundation, Inc.,
%%% 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
%%%
%%%----------------------------------------------------------------------
-ifdef(ERL_DEPRECATED_TYPES).
-define(TDICT, dict()).
-define(TGB_TREE, gb_tree()).
-define(TGB_SET, gb_set()).
-define(TQUEUE, queue()).
-else.
-define(TDICT, dict:dict()).
-define(TGB_TREE, gb_trees:tree()).
-define(TGB_SET, gb_sets:set()).
-define(TQUEUE, queue:queue()).
-endif.

View File

@ -84,20 +84,3 @@ EOF
AC_MSG_RESULT([ok])
fi
]) dnl ERLANG_VERSION_CHECK
AC_DEFUN([ERLANG_DEPRECATED_TYPES_CHECK],
[ AC_MSG_CHECKING([whether Erlang is using deprecated types])
cat > conftest.erl <<EOF
-module(conftest).
-record(state, {host = dict:new() :: dict:dict()}).
EOF
if $ERLC conftest.erl > /dev/null 2>&1; then
AC_MSG_RESULT([no])
AC_SUBST(erlang_deprecated_types, false)
else
AC_MSG_RESULT([yes])
AC_SUBST(erlang_deprecated_types, true)
fi
])

View File

@ -96,7 +96,6 @@
{if_var_true, roster_gateway_workaround, {d, 'ROSTER_GATWAY_WORKAROUND'}},
{if_var_match, db_type, mssql, {d, 'mssql'}},
{if_var_true, elixir, {d, 'ELIXIR_ENABLED'}},
{if_var_true, erlang_deprecated_types, {d, 'ERL_DEPRECATED_TYPES'}},
{if_have_fun, {crypto, strong_rand_bytes, 1}, {d, 'STRONG_RAND_BYTES'}},
{if_have_fun, {rand, uniform, 1}, {d, 'RAND_UNIFORM'}},
{if_have_fun, {gb_sets, iterator_from, 2}, {d, 'GB_SETS_ITERATOR_FROM'}},

View File

@ -44,7 +44,6 @@
handle_sync_event/4, handle_info/3, terminate/3,
code_change/4]).
-include("type_compat.hrl").
-include("logger.hrl").
-include("xmpp.hrl").
-include("ejabberd_http.hrl").
@ -100,8 +99,8 @@
prev_key = <<"">> :: binary(),
prev_poll :: erlang:timestamp() | undefined,
max_concat = unlimited :: unlimited | non_neg_integer(),
responses = gb_trees:empty() :: ?TGB_TREE,
receivers = gb_trees:empty() :: ?TGB_TREE,
responses = gb_trees:empty() :: gb_trees:tree(),
receivers = gb_trees:empty() :: gb_trees:tree(),
shaped_receivers :: p1_queue:queue(),
ip :: inet:ip_address(),
max_requests = 1 :: non_neg_integer()}).

View File

@ -65,7 +65,6 @@
-behaviour(p1_fsm).
-include("type_compat.hrl").
-include("logger.hrl").
%% External exports
@ -139,8 +138,8 @@
passwd = <<"">> :: binary(),
id = 0 :: non_neg_integer(),
bind_timer = make_ref() :: reference(),
dict = dict:new() :: ?TDICT,
req_q = queue:new() :: ?TQUEUE}).
dict = dict:new() :: dict:dict(),
req_q = queue:new() :: queue:queue()}).
%%%----------------------------------------------------------------------
%%% API

View File

@ -40,13 +40,12 @@
disco_local_features/5, disco_sm_features/5,
disco_local_identity/5, disco_sm_identity/5]).
-include("type_compat.hrl").
-include("logger.hrl").
-include("xmpp.hrl").
-type disco_acc() :: {error, stanza_error()} | {result, [binary()]} | empty.
-record(state, {server_host = <<"">> :: binary(),
delegations = dict:new() :: ?TDICT}).
delegations = dict:new() :: dict:dict()}).
-type state() :: #state{}.
%%%===================================================================
@ -222,7 +221,7 @@ code_change(_OldVsn, State, _Extra) ->
%%%===================================================================
%%% Internal functions
%%%===================================================================
-spec get_delegations(binary()) -> ?TDICT.
-spec get_delegations(binary()) -> dict:dict().
get_delegations(Host) ->
Proc = gen_mod:get_module_proc(Host, ?MODULE),
try gen_server:call(Proc, get_delegations) of

View File

@ -39,7 +39,6 @@
handle_sync_event/4, handle_info/3, terminate/3,
code_change/4]).
-include("type_compat.hrl").
-include("logger.hrl").
-include("xmpp.hrl").
@ -57,7 +56,7 @@
ident = <<"">> :: binary(),
realname = <<"">> :: binary(),
nick = <<"">> :: binary(),
channels = dict:new() :: ?TDICT,
channels = dict:new() :: dict:dict(),
nickchannel :: binary() | undefined,
webirc_password :: binary(),
mod = mod_irc :: atom(),

View File

@ -83,10 +83,10 @@
-callback set_affiliation(binary(), binary(), binary(), jid(), affiliation(),
binary()) -> ok | {error, any()}.
-callback set_affiliations(binary(), binary(), binary(),
?TDICT) -> ok | {error, any()}.
dict:dict()) -> ok | {error, any()}.
-callback get_affiliation(binary(), binary(), binary(),
binary(), binary()) -> {ok, affiliation()} | {error, any()}.
-callback get_affiliations(binary(), binary(), binary()) -> {ok, ?TDICT} | {error, any()}.
-callback get_affiliations(binary(), binary(), binary()) -> {ok, dict:dict()} | {error, any()}.
-callback search_affiliation(binary(), binary(), binary(), affiliation()) ->
{ok, [{ljid(), {affiliation(), binary()}}]} | {error, any()}.
@ -1106,7 +1106,7 @@ close_room_if_temporary_and_empty(StateData1) ->
_ -> {next_state, normal_state, StateData1}
end.
-spec get_users_and_subscribers(state()) -> ?TDICT.
-spec get_users_and_subscribers(state()) -> dict:dict().
get_users_and_subscribers(StateData) ->
OnlineSubscribers = ?DICT:fold(
fun(LJID, _, Acc) ->
@ -1291,7 +1291,7 @@ set_affiliation_fallback(JID, Affiliation, StateData, Reason) ->
end,
StateData#state{affiliations = Affiliations}.
-spec set_affiliations(?TDICT, state()) -> state().
-spec set_affiliations(dict:dict(), state()) -> state().
set_affiliations(Affiliations,
#state{config = #config{persistent = false}} = StateData) ->
set_affiliations_fallback(Affiliations, StateData);
@ -1307,7 +1307,7 @@ set_affiliations(Affiliations, StateData) ->
set_affiliations_fallback(Affiliations, StateData)
end.
-spec set_affiliations_fallback(?TDICT, state()) -> state().
-spec set_affiliations_fallback(dict:dict(), state()) -> state().
set_affiliations_fallback(Affiliations, StateData) ->
StateData#state{affiliations = Affiliations}.
@ -1370,7 +1370,7 @@ do_get_affiliation_fallback(JID, StateData) ->
end
end.
-spec get_affiliations(state()) -> ?TDICT.
-spec get_affiliations(state()) -> dict:dict().
get_affiliations(#state{config = #config{persistent = false}} = StateData) ->
get_affiliations_callback(StateData);
get_affiliations(StateData) ->
@ -1385,7 +1385,7 @@ get_affiliations(StateData) ->
Affiliations
end.
-spec get_affiliations_callback(state()) -> ?TDICT.
-spec get_affiliations_callback(state()) -> dict:dict().
get_affiliations_callback(StateData) ->
StateData#state.affiliations.
@ -4385,7 +4385,7 @@ wrap(From, To, Packet, Node) ->
%% JIDs = [ User#user.jid || {_, User} <- ?DICT:to_list(Users)],
%% ejabberd_router_multicast:route_multicast(From, Server, JIDs, Packet).
-spec send_wrapped_multiple(jid(), ?TDICT, stanza(), binary(), state()) -> ok.
-spec send_wrapped_multiple(jid(), dict:dict(), stanza(), binary(), state()) -> ok.
send_wrapped_multiple(From, Users, Packet, Node, State) ->
lists:foreach(
fun({_, #user{jid = To}}) ->

View File

@ -39,12 +39,11 @@
roster_access/2, process_message/1,
process_presence_out/1, process_presence_in/1]).
-include("type_compat.hrl").
-include("logger.hrl").
-include("xmpp.hrl").
-record(state, {server_host = <<"">> :: binary(),
permissions = dict:new() :: ?TDICT}).
permissions = dict:new() :: dict:dict()}).
%%%===================================================================
%%% API

View File

@ -24,7 +24,6 @@
{db_type, @db_type@}.
{debug, @debug@}.
{hipe, @hipe@}.
{erlang_deprecated_types, @erlang_deprecated_types@}.
{new_sql_schema, @new_sql_schema@}.
%% Ad-hoc directories with source files