aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-03-08 06:47:43 +0100
committerBjörn Gustavsson <[email protected]>2016-03-11 10:10:23 +0100
commit3159fa506c2ddf4cbca9887be798c67e32a981cc (patch)
tree795ad71d98edc251bfe4cac7854ae29eb20bbcca /lib
parentd369571f10ccc5ebf4548f4dbc74efe649c5e669 (diff)
downloadotp-3159fa506c2ddf4cbca9887be798c67e32a981cc.tar.gz
otp-3159fa506c2ddf4cbca9887be798c67e32a981cc.tar.bz2
otp-3159fa506c2ddf4cbca9887be798c67e32a981cc.zip
Clean up splitting of node names
Diffstat (limited to 'lib')
-rw-r--r--lib/kernel/src/net_kernel.erl9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/kernel/src/net_kernel.erl b/lib/kernel/src/net_kernel.erl
index 35a54f591e..45a0e26933 100644
--- a/lib/kernel/src/net_kernel.erl
+++ b/lib/kernel/src/net_kernel.erl
@@ -1202,8 +1202,7 @@ get_proto_mod(_Family, _Protocol, []) ->
%% -------- Initialisation functions ------------------------
init_node(Name, LongOrShortNames) ->
- {NameWithoutHost,_Host} = lists:splitwith(fun($@)->false;(_)->true end,
- atom_to_list(Name)),
+ {NameWithoutHost,_Host} = split_node(Name),
case create_name(Name, LongOrShortNames, 1) of
{ok,Node} ->
case start_protos(list_to_atom(NameWithoutHost),Node) of
@@ -1240,8 +1239,7 @@ create_name(Name, LongOrShortNames, Try) ->
end.
create_hostpart(Name, LongOrShortNames) ->
- {Head,Host} = lists:splitwith(fun($@)->false;(_)->true end,
- atom_to_list(Name)),
+ {Head,Host} = split_node(Name),
Host1 = case {Host,LongOrShortNames} of
{[$@,_|_],longnames} ->
{ok,Host};
@@ -1268,6 +1266,9 @@ create_hostpart(Name, LongOrShortNames) ->
end,
{Head,Host1}.
+split_node(Name) ->
+ lists:splitwith(fun(C) -> C =/= $@ end, atom_to_list(Name)).
+
%%
%%
%%