aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2016-12-13 10:38:27 +0100
committerHans Nilsson <[email protected]>2016-12-16 15:26:49 +0100
commit2b36238bc2a2444b97a3d01fa35ab1ceecfe1c4d (patch)
tree52bcf66c3ef594315fd542b070823ab3108ddd99
parent5901661b62a006a6c55d77503a7198c7c56dabe7 (diff)
downloadotp-2b36238bc2a2444b97a3d01fa35ab1ceecfe1c4d.tar.gz
otp-2b36238bc2a2444b97a3d01fa35ab1ceecfe1c4d.tar.bz2
otp-2b36238bc2a2444b97a3d01fa35ab1ceecfe1c4d.zip
ssh: Optimize ssh_bits:name_list
It is better (=faster) to use built-in functions and library functions.
-rw-r--r--lib/ssh/src/ssh_bits.erl8
1 files changed, 1 insertions, 7 deletions
diff --git a/lib/ssh/src/ssh_bits.erl b/lib/ssh/src/ssh_bits.erl
index 8bedaaf0c5..cc2e7e2be5 100644
--- a/lib/ssh/src/ssh_bits.erl
+++ b/lib/ssh/src/ssh_bits.erl
@@ -30,13 +30,7 @@
-export([random/1]).
%%%----------------------------------------------------------------
-name_list([Name]) -> to_bin(Name);
-name_list([Name|Ns]) -> <<(to_bin(Name))/binary, ",", (name_list(Ns))/binary>>;
-name_list([]) -> <<>>.
-
-to_bin(A) when is_atom(A) -> list_to_binary(atom_to_list(A));
-to_bin(S) when is_list(S) -> list_to_binary(S);
-to_bin(B) when is_binary(B) -> B.
+name_list(NamesList) -> list_to_binary(lists:join($,, NamesList)).
%%%----------------------------------------------------------------
%%% Multi Precision Integer encoding