From e2e49ee0b0292da4a48d90ed762d7df0b3a64f78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Thu, 26 Nov 2015 11:23:41 +0100 Subject: init: Eliminate the concat/1 function There is no need to use the concat/1 function since all arguments that are passed to it have known types. --- erts/preloaded/src/init.erl | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) (limited to 'erts') diff --git a/erts/preloaded/src/init.erl b/erts/preloaded/src/init.erl index 197bc5fde8..383c4a1ec6 100644 --- a/erts/preloaded/src/init.erl +++ b/erts/preloaded/src/init.erl @@ -338,7 +338,7 @@ boot_loop(BootPid, State) -> end. ensure_loaded(Module, Loaded) -> - File = concat([Module,objfile_extension()]), + File = atom_to_list(Module) ++ objfile_extension(), case catch load_mod(Module,File) of {ok, FullName} -> {{module, Module}, [{Module, FullName}|Loaded]}; @@ -773,7 +773,7 @@ get_boot_vars_1(Vars, []) -> Vars. bootfile(Flags,Root) -> - b2s(get_flag(boot, Flags, concat([Root,"/bin/start"]))). + b2s(get_flag(boot, Flags, Root++"/bin/start")). path_flags(Flags) -> Pa = append(reverse(get_flag_args(pa, Flags))), @@ -781,12 +781,12 @@ path_flags(Flags) -> {bs2ss(Pa),bs2ss(Pz)}. get_boot(BootFile0,Root) -> - BootFile = concat([BootFile0,".boot"]), + BootFile = BootFile0 ++ ".boot", case get_boot(BootFile) of {ok, CmdList} -> CmdList; not_found -> %% Check for default. - BootF = concat([Root,"/bin/",BootFile]), + BootF = Root ++ "/bin/" ++ BootFile, case get_boot(BootF) of {ok, CmdList} -> CmdList; @@ -874,7 +874,7 @@ eval_script(What, #es{}) -> exit({'unexpected command in bootfile',What}). load_modules([Mod|Mods], Init) -> - File = concat([Mod,objfile_extension()]), + File = atom_to_list(Mod) ++ objfile_extension(), {ok,Full} = load_mod(Mod,File), Init ! {self(),loaded,{Mod,Full}}, %Tell init about loaded module load_modules(Mods, Init); @@ -1228,17 +1228,6 @@ set_argument([Item|Flags],Flag,Value) -> set_argument([],Flag,Value) -> [{Flag,[Value]}]. -concat([A|T]) when is_atom(A) -> - atom_to_list(A) ++ concat(T); -concat([C|T]) when is_integer(C), 0 =< C, C =< 255 -> - [C|concat(T)]; -concat([Bin|T]) when is_binary(Bin) -> - binary_to_list(Bin) ++ concat(T); -concat([S|T]) -> - S ++ concat(T); -concat([]) -> - []. - append([E]) -> E; append([H|T]) -> H ++ append(T); -- cgit v1.2.3