25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

Dialyzer: Replace re:mp dirty workaround from 0bbc255 with other less dirty

This commit is contained in:
Badlop 2024-02-29 16:43:04 +01:00
parent cd30538130
commit 2378ea9c07
6 changed files with 16 additions and 16 deletions

View File

@ -579,9 +579,7 @@ Makefile: Makefile.in
ifeq "$(REBAR_VER)" "3"
dialyzer:
find src/*_opt.erl -type f \! -regex ".*git.*" -exec sed -i 's/re:mp/ tuple/g' {} \;
$(REBAR) dialyzer
find src/*_opt.erl -type f \! -regex ".*git.*" -exec sed -i 's/ tuple/re:mp/g' {} \;
else
deps := $(wildcard $(DEPSDIR)/*/ebin)

View File

@ -62,7 +62,5 @@
_ -> 'Elixir.Logger':bare_log(error, io_lib:format(Format, Args), [?MODULE])
end).
-type re_mp() :: {re_pattern, _, _, _, _}. % Copied from re.erl
%% Uncomment if you want to debug p1_fsm/gen_fsm
%%-define(DBGFSM, true).

View File

@ -39,14 +39,14 @@
-type acl_rule() :: {user, {binary(), binary()} | binary()} |
{server, binary()} |
{resource, binary()} |
{user_regexp, {re_mp(), binary()} | re_mp()} |
{server_regexp, re_mp()} |
{resource_regexp, re_mp()} |
{node_regexp, {re_mp(), re_mp()}} |
{user_glob, {re_mp(), binary()} | re_mp()} |
{server_glob, re_mp()} |
{resource_glob, re_mp()} |
{node_glob, {re_mp(), re_mp()}} |
{user_regexp, {misc:re_mp(), binary()} | misc:re_mp()} |
{server_regexp, misc:re_mp()} |
{resource_regexp, misc:re_mp()} |
{node_regexp, {misc:re_mp(), misc:re_mp()}} |
{user_glob, {misc:re_mp(), binary()} | misc:re_mp()} |
{server_glob, misc:re_mp()} |
{resource_glob, misc:re_mp()} |
{node_glob, {misc:re_mp(), misc:re_mp()}} |
{shared_group, {binary(), binary()} | binary()} |
{ip, ip_mask()}.
-type access() :: [{action(), [access_rule()]}].
@ -348,7 +348,7 @@ node_validator(UV, SV) ->
%%%===================================================================
%%% Aux
%%%===================================================================
-spec match_regexp(iodata(), re_mp()) -> boolean().
-spec match_regexp(iodata(), misc:re_mp()) -> boolean().
match_regexp(Data, RegExp) ->
re:run(Data, RegExp) /= nomatch.

View File

@ -54,6 +54,10 @@
-include_lib("xmpp/include/xmpp.hrl").
-include_lib("kernel/include/file.hrl").
%% Copied from erlang/otp/lib/stdlib/src/re.erl
-type re_mp() :: {re_pattern, _, _, _, _}.
-export_type([re_mp/0]).
-type distance_cache() :: #{{string(), string()} => non_neg_integer()}.
-spec uri_parse(binary()|string()) -> {ok, string(), string(), string(), number(), string(), string()} | {error, term()}.

View File

@ -72,7 +72,7 @@
user_desc = <<"">> :: binary(),
user_uid = <<"">> :: binary(),
uid_format = <<"">> :: binary(),
uid_format_re :: undefined | re_mp(),
uid_format_re :: undefined | misc:re_mp(),
filter = <<"">> :: binary(),
ufilter = <<"">> :: binary(),
rfilter = <<"">> :: binary(),

View File

@ -320,9 +320,9 @@ spec(ip_mask, 0, _, _) ->
spec(port, 0, _, _) ->
erl_types:t_from_range(1, 65535);
spec(re, A, _, _) when A == 0; A == 1 ->
t_remote(re, mp);
t_remote(misc, re_mp);
spec(glob, A, _, _) when A == 0; A == 1 ->
t_remote(re, mp);
t_remote(misc, re_mp);
spec(path, 0, _, _) ->
erl_types:t_binary();
spec(binary_sep, 1, _, _) ->