File 0256-Automatically-start-lcnt-server-on-first-use.patch of Package erlang

From ab965710d014912cbd3c4ef8f9c3acc0dffa1d30 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?John=20H=C3=B6gberg?= <john@erlang.org>
Date: Fri, 9 Feb 2018 10:24:43 +0100
Subject: [PATCH] Automatically start lcnt server on first use

lcnt:collect is documented as implicitly starting the lcnt server
but didn't do so prior to this commit. I've decided to extend this
behavior to all operations as the overhead is negligible and it's
a bit more convenient to use.
---
 lib/tools/src/lcnt.erl        | 7 ++++---
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/lib/tools/src/lcnt.erl b/lib/tools/src/lcnt.erl
index 139b3d8a4a..20b031a7ad 100644
--- a/lib/tools/src/lcnt.erl
+++ b/lib/tools/src/lcnt.erl
@@ -218,9 +218,11 @@ raw()                -> call(raw).
 set(Option, Value)   -> call({set, Option, Value}).
 set({Option, Value}) -> call({set, Option, Value}).
 save(Filename)       -> call({save, Filename}).
-load(Filename)       -> ok = start_internal(), call({load, Filename}).
+load(Filename)       -> call({load, Filename}).
 
-call(Msg) -> gen_server:call(?MODULE, Msg, infinity).
+call(Msg) ->
+    ok = start_internal(),
+    gen_server:call(?MODULE, Msg, infinity).
 
 %% -------------------------------------------------------------------- %%
 %%
@@ -237,7 +239,6 @@ apply(Fun) when is_function(Fun) ->
     lcnt:apply(Fun, []).
 
 apply(Fun, As) when is_function(Fun) ->
-    ok = start_internal(),
     Opt = lcnt:rt_opt({copy_save, true}),
     lcnt:clear(),
     Res = erlang:apply(Fun, As),
-- 
2.16.1

openSUSE Build Service is sponsored by