File 2128-Simplify-for-rflat.patch of Package erlang

From 3900d246682a46cec3b4dcf4c1b13259038ab358 Mon Sep 17 00:00:00 2001
From: Richard Carlsson <richardc@klarna.com>
Date: Wed, 16 Nov 2016 15:11:45 +0100
Subject: [PATCH 08/12] Simplify for rflat

---
 lib/kernel/src/disk_log.erl        | 11 ++++-------
 lib/kernel/test/disk_log_SUITE.erl | 10 +++++-----
 2 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/lib/kernel/src/disk_log.erl b/lib/kernel/src/disk_log.erl
index bc31f1fbb..2a7afb4c5 100644
--- a/lib/kernel/src/disk_log.erl
+++ b/lib/kernel/src/disk_log.erl
@@ -125,13 +125,13 @@ open(A) ->
       Log :: log(),
       Term :: term().
 log(Log, Term) -> 
-    req(Log, {log, term_to_binary(Term)}).
+    req(Log, {log, [term_to_binary(Term)]}).
 
 -spec blog(Log, Bytes) -> ok | {error, Reason :: log_error_rsn()} when
       Log :: log(),
       Bytes :: iodata().
 blog(Log, Bytes) ->
-    req(Log, {blog, ensure_binary(Bytes)}).
+    req(Log, {blog, [ensure_binary(Bytes)]}).
 
 -spec log_terms(Log, TermList) -> ok | {error, Resaon :: log_error_rsn()} when
       Log :: log(),
@@ -154,7 +154,7 @@ blog_terms(Log, Bytess) ->
       Log :: log(),
       Term :: term().
 alog(Log, Term) -> 
-    notify(Log, {alog, term_to_binary(Term)}).
+    notify(Log, {alog, [term_to_binary(Term)]}).
 
 -spec alog_terms(Log, TermList) -> notify_ret() when
       Log :: log(),
@@ -167,7 +167,7 @@ alog_terms(Log, Terms) ->
       Log :: log(),
       Bytes :: iodata().
 balog(Log, Bytes) ->
-    notify(Log, {balog, ensure_binary(Bytes)}).
+    notify(Log, {balog, [ensure_binary(Bytes)]}).
 
 -spec balog_terms(Log, ByteList) -> notify_ret() when
       Log :: log(),
@@ -1093,12 +1093,9 @@ log_end_sync(S, Sync) ->
     state_err(S, Res).
 
 %% Inlined.
-rflat([B]=L) when is_binary(B) -> L;
 rflat([B]) -> B;
 rflat(B) -> rflat(B, []).
 
-rflat([B | Bs], L) when is_binary(B) ->
-    rflat(Bs, [B | L]);
 rflat([B | Bs], L) ->
     rflat(Bs, B ++ L);
 rflat([], L) -> L.
diff --git a/lib/kernel/test/disk_log_SUITE.erl b/lib/kernel/test/disk_log_SUITE.erl
index f7ad9c0c0..a25b315d9 100644
--- a/lib/kernel/test/disk_log_SUITE.erl
+++ b/lib/kernel/test/disk_log_SUITE.erl
@@ -421,7 +421,7 @@ halt_ro_alog(Conf) when is_list(Conf) ->
 halt_ro_alog_wait_notify(Log, T) ->
     Term = term_to_binary(T),
     receive
-	{disk_log, _, Log,{read_only, Term}} ->
+	{disk_log, _, Log,{read_only, [Term]}} ->
 	    ok;
 	Other ->
 	    Other
@@ -449,7 +449,7 @@ halt_ro_balog(Conf) when is_list(Conf) ->
 halt_ro_balog_wait_notify(Log, T) ->
     Term = list_to_binary(T),
     receive
-	{disk_log, _, Log,{read_only, Term}} ->
+	{disk_log, _, Log,{read_only, [Term]}} ->
 	    ok;
 	Other ->
 	    Other
@@ -1385,15 +1385,15 @@ blocked_notif(Conf) when is_list(Conf) ->
     "The requested operation" ++ _ = format_error(Error1),
     ok = disk_log:blog(n, B),
     ok = disk_log:alog(n, B),
-    rec(1, {disk_log, node(), n, {format_external, term_to_binary(B)}}),
+    rec(1, {disk_log, node(), n, {format_external, [term_to_binary(B)]}}),
     ok = disk_log:alog_terms(n, [B,B,B,B]),
     rec(1, {disk_log, node(), n, {format_external,
 				  lists:map(fun term_to_binary/1, [B,B,B,B])}}),
     ok = disk_log:block(n, false),
     ok = disk_log:alog(n, B),
-    rec(1, {disk_log, node(), n, {blocked_log, term_to_binary(B)}}),
+    rec(1, {disk_log, node(), n, {blocked_log, [term_to_binary(B)]}}),
     ok = disk_log:balog(n, B),
-    rec(1, {disk_log, node(), n, {blocked_log, list_to_binary(B)}}),
+    rec(1, {disk_log, node(), n, {blocked_log, [list_to_binary(B)]}}),
     ok = disk_log:balog_terms(n, [B,B,B,B]),
     disk_log:close(n),
     rec(1, {disk_log, node(), n, {blocked_log,
-- 
2.11.0

openSUSE Build Service is sponsored by