File 0639-snmp-replace-size-1-by-XXX_size-1.patch of Package erlang
From 6f35cb6f551d8b33e22f374cec79f7a00a4edcd5 Mon Sep 17 00:00:00 2001
From: Kiko Fernandez-Reyes <kiko@erlang.org>
Date: Tue, 17 Jan 2023 14:39:37 +0100
Subject: [PATCH] snmp: replace size/1 by XXX_size/1
---
lib/snmp/src/agent/snmpa_net_if.erl | 4 ++--
lib/snmp/test/snmp_agent_SUITE.erl | 2 +-
lib/snmp/test/snmp_test_lib.erl | 8 ++++----
lib/snmp/test/snmp_test_mgr.erl | 12 +++++-------
lib/snmp/test/snmp_test_mgr_misc.erl | 2 +-
5 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/lib/snmp/src/agent/snmpa_net_if.erl b/lib/snmp/src/agent/snmpa_net_if.erl
index b187e6971d..5bb6856374 100644
--- a/lib/snmp/src/agent/snmpa_net_if.erl
+++ b/lib/snmp/src/agent/snmpa_net_if.erl
@@ -1656,7 +1656,7 @@ udp_send(Socket, To, B) ->
ok;
ok ->
%% For future use! Ephemeral ports!
- {ok, size(B)}
+ {ok, byte_size(B)}
catch
error:ExitReason:StackTrace ->
error_msg("[exit] cannot send message "
@@ -1665,7 +1665,7 @@ udp_send(Socket, To, B) ->
end.
sz(L) when is_list(L) -> length(L);
-sz(B) when is_binary(B) -> size(B);
+sz(B) when is_binary(B) -> byte_size(B);
sz(_) -> undefined.
diff --git a/lib/snmp/test/snmp_agent_SUITE.erl b/lib/snmp/test/snmp_agent_SUITE.erl
index f19e4cd99d..eceb3cff27 100644
--- a/lib/snmp/test/snmp_agent_SUITE.erl
+++ b/lib/snmp/test/snmp_agent_SUITE.erl
@@ -2898,7 +2898,7 @@ dummy_manager_loop(P,S,MA) ->
%% -ifdef(snmp_log).
dummy_manager_message_sz(B) when is_binary(B) ->
- size(B);
+ byte_size(B);
dummy_manager_message_sz(L) when is_list(L) ->
length(L);
dummy_manager_message_sz(_) ->
diff --git a/lib/snmp/test/snmp_test_lib.erl b/lib/snmp/test/snmp_test_lib.erl
index 427f56e8d1..439892bfab 100644
--- a/lib/snmp/test/snmp_test_lib.erl
+++ b/lib/snmp/test/snmp_test_lib.erl
@@ -397,10 +397,10 @@ which_addr(Family, [{_Name, IfOpts} | IfList]) ->
which_addr2(_Family, []) ->
{error, not_found};
which_addr2(Family, [{addr, Addr}|_])
- when (Family =:= inet) andalso (size(Addr) =:= 4) ->
+ when (Family =:= inet) andalso (tuple_size(Addr) =:= 4) ->
{ok, Addr};
which_addr2(Family, [{addr, Addr}|_])
- when (Family =:= inet6) andalso (size(Addr) =:= 8) ->
+ when (Family =:= inet6) andalso (tuple_size(Addr) =:= 8) ->
{ok, Addr};
which_addr2(Family, [_|IfOpts]) ->
which_addr2(Family, IfOpts).
@@ -409,7 +409,7 @@ which_addr2(Family, [_|IfOpts]) ->
sz(L) when is_list(L) ->
length(L);
sz(B) when is_binary(B) ->
- size(B);
+ byte_size(B);
sz(O) ->
{unknown_size,O}.
@@ -683,7 +683,7 @@ old_has_support_ipv6() ->
old_has_support_ipv6(Hostname) ->
case inet:getaddr(Hostname, inet6) of
- {ok, Addr} when (size(Addr) =:= 8) andalso
+ {ok, Addr} when (tuple_size(Addr) =:= 8) andalso
(element(1, Addr) =/= 0) andalso
(element(1, Addr) =/= 16#fe80) ->
true;
diff --git a/lib/snmp/test/snmp_test_mgr.erl b/lib/snmp/test/snmp_test_mgr.erl
index 054e7ea108..d8abc04f34 100644
--- a/lib/snmp/test/snmp_test_mgr.erl
+++ b/lib/snmp/test/snmp_test_mgr.erl
@@ -256,14 +256,12 @@ init({Options, CallerPid}) ->
IpFamily = get_value(ipfamily, Options, inet),
?IPRINT("init -> IpFamily: ~p", [IpFamily]),
AgIp = case snmp_misc:assq(agent, Options) of
- {value, Addr} when is_tuple(Addr) andalso
- (size(Addr) =:= 4) andalso
- (IpFamily =:= inet) ->
+ {value, Addr} when (tuple_size(Addr) =:= 4) andalso
+ (IpFamily =:= inet) ->
?IPRINT("init -> Addr: ~p", [Addr]),
Addr;
- {value, Addr} when is_tuple(Addr) andalso
- (size(Addr) =:= 8) andalso
- (IpFamily =:= inet6) ->
+ {value, Addr} when (tuple_size(Addr) =:= 8) andalso
+ (IpFamily =:= inet6) ->
?IPRINT("init -> Addr: ~p", [Addr]),
Addr;
{value, Host} when is_list(Host) ->
@@ -1304,7 +1302,7 @@ cast(Msg) ->
sizeOf(L) when is_list(L) ->
length(lists:flatten(L));
sizeOf(B) when is_binary(B) ->
- size(B).
+ byte_size(B).
d(F) -> d(F, []).
d(F, A) -> d(get(debug), F, A).
diff --git a/lib/snmp/test/snmp_test_mgr_misc.erl b/lib/snmp/test/snmp_test_mgr_misc.erl
index 73f338c01c..b967e5f4c3 100644
--- a/lib/snmp/test/snmp_test_mgr_misc.erl
+++ b/lib/snmp/test/snmp_test_mgr_misc.erl
@@ -961,7 +961,7 @@ display_prop_hdr(S) ->
sz(L) when is_list(L) ->
iolist_size(L);
sz(B) when is_binary(B) ->
- size(B);
+ byte_size(B);
sz(O) ->
{unknown_size, O}.
--
2.35.3