Skip to content

Commit 67513dc

Browse files
committed
otp: Fix usages of deprecated format_status/2 callback
1 parent 514d208 commit 67513dc

File tree

7 files changed

+27
-35
lines changed

7 files changed

+27
-35
lines changed

lib/inets/src/http_server/httpd_request_handler.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
-module(httpd_request_handler).
2525
-moduledoc false.
26-
26+
-compile(nowarn_deprecated_callback).
2727
-behaviour(gen_server).
2828

2929
%% Application internal API

lib/kernel/src/erl_signal_handler.erl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
-module(erl_signal_handler).
2222
-moduledoc false.
2323
-behaviour(gen_event).
24-
-export([start/0, init/1, format_status/2,
24+
-export([start/0, init/1,
2525
handle_event/2, handle_call/2, handle_info/2,
2626
terminate/2, code_change/3]).
2727

@@ -58,9 +58,6 @@ handle_info(_Info, S) ->
5858
handle_call(_Request, S) ->
5959
{ok, ok, S}.
6060

61-
format_status(_Opt, [_Pdict,_S]) ->
62-
ok.
63-
6461
code_change(_OldVsn, S, _Extra) ->
6562
{ok, S}.
6663

lib/os_mon/src/disksup.erl

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ value of configuration parameters.
8484
terminate/2]).
8585

8686
%% Other exports
87-
-export([format_status/2, parse_df/2]).
87+
-export([format_status/1, parse_df/2]).
8888

8989
-doc """
9090
Supported units:
@@ -370,13 +370,14 @@ terminate(_Reason, State) ->
370370
%%----------------------------------------------------------------------
371371

372372
-doc false.
373-
format_status(_Opt, [_PDict, #state{os = OS, threshold = Threshold,
374-
timeout = Timeout,
375-
diskdata = DiskData}]) ->
376-
[{data, [{"OS", OS},
377-
{"Timeout", Timeout},
378-
{"Threshold", Threshold},
379-
{"DiskData", DiskData}]}].
373+
format_status(#{ state := #state{os = OS, threshold = Threshold,
374+
timeout = Timeout,
375+
diskdata = DiskData}} = Status) ->
376+
Status#{ state := [{"OS", OS},
377+
{"Timeout", Timeout},
378+
{"Threshold", Threshold},
379+
{"DiskData", DiskData}]
380+
}.
380381

381382
%%----------------------------------------------------------------------
382383
%% Internal functions

lib/os_mon/src/memsup.erl

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ value of configuration parameters.
120120
terminate/2]).
121121

122122
%% Other exports
123-
-export([format_status/2]).
123+
-export([format_status/1]).
124124

125125
-include("memsup.hrl").
126126

@@ -779,19 +779,20 @@ terminate(_Reason, State) ->
779779
%%----------------------------------------------------------------------
780780

781781
-doc false.
782-
format_status(_Opt, [_PDict, #state{timeout=Timeout, mem_usage=MemUsage,
783-
worst_mem_user=WorstMemUser}]) ->
782+
format_status(#{ state := #state{timeout=Timeout, mem_usage=MemUsage,
783+
worst_mem_user=WorstMemUser} } = Status) ->
784784
{Allocated, Total} = MemUsage,
785785
WorstMemFormat = case WorstMemUser of
786-
{Pid, Mem} ->
787-
[{"Pid", Pid}, {"Memory", Mem}];
788-
undefined ->
789-
undefined
790-
end,
791-
[{data, [{"Timeout", Timeout}]},
792-
{items, {"Memory Usage", [{"Allocated", Allocated},
793-
{"Total", Total}]}},
794-
{items, {"Worst Memory User", WorstMemFormat}}].
786+
{Pid, Mem} ->
787+
[{"Pid", Pid}, {"Memory", Mem}];
788+
undefined ->
789+
undefined
790+
end,
791+
Status#{ state :=
792+
[{"Timeout", Timeout},
793+
{"Memory Usage", [{"Allocated", Allocated},
794+
{"Total", Total}]},
795+
{"Worst Memory User", WorstMemFormat}] }.
795796

796797

797798
%%----------------------------------------------------------------------

lib/ssh/src/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ endif
135135
# ----------------------------------------------------
136136
# FLAGS
137137
# ----------------------------------------------------
138-
EXTRA_ERLC_FLAGS = +warn_unused_vars
138+
EXTRA_ERLC_FLAGS = +warn_unused_vars +nowarn_deprecated_callback
139139
ERL_COMPILE_FLAGS += -I$(ERL_TOP)/lib/kernel/src \
140140
-pz $(EBIN) \
141141
-pz $(ERL_TOP)/lib/public_key/ebin \

lib/ssl/src/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ endif
170170
# ----------------------------------------------------
171171
# FLAGS
172172
# ----------------------------------------------------
173-
EXTRA_ERLC_FLAGS = +warn_unused_vars -Werror
173+
EXTRA_ERLC_FLAGS = +warn_unused_vars -Werror +nowarn_deprecated_callback
174174
ERL_COMPILE_FLAGS += -I$(ERL_TOP)/lib/kernel/src \
175175
-pz $(EBIN) \
176176
-pz $(ERL_TOP)/lib/public_key/ebin \

lib/stdlib/src/supervisor.erl

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ but the map is preferred.
290290

291291
%% Internal exports
292292
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
293-
terminate/2, code_change/3, format_status/2]).
293+
terminate/2, code_change/3]).
294294

295295
%% logger callback
296296
-export([format_log/1, format_log/2]).
@@ -2243,13 +2243,6 @@ single(false) -> "".
22432243
mod(latin1) -> "";
22442244
mod(_) -> "t".
22452245

2246-
-doc false.
2247-
format_status(terminate, [_PDict, State]) ->
2248-
State;
2249-
format_status(_, [_PDict, State]) ->
2250-
[{data, [{"State", State}]},
2251-
{supervisor, [{"Callback", State#state.module}]}].
2252-
22532246
%%%-----------------------------------------------------------------
22542247
%%% Dynamics database access.
22552248
%%%

0 commit comments

Comments
 (0)