File 2491-Remove-duplication-of-SSH-encoding-macros.patch of Package erlang

From 508ddd5aaa189ddcf7a06f4342c187b07ec1734a Mon Sep 17 00:00:00 2001
From: Paul Meinhardt <paul@bitcrowd.net>
Date: Sun, 26 May 2019 15:34:19 +0200
Subject: [PATCH] Remove duplication of SSH encoding macros

---
 lib/ssh/src/ssh.hrl           | 19 +++++++++++++++++++
 lib/ssh/src/ssh_message.erl   | 18 ------------------
 lib/ssh/src/ssh_transport.erl |  8 --------
 3 files changed, 19 insertions(+), 26 deletions(-)

diff --git a/lib/ssh/src/ssh.hrl b/lib/ssh/src/ssh.hrl
index 04453e6ef0..54e98ee10e 100644
--- a/lib/ssh/src/ssh.hrl
+++ b/lib/ssh/src/ssh.hrl
@@ -71,6 +71,25 @@
 %% Other macros
 -define(to_binary(X), (try iolist_to_binary(X) catch _:_ -> unicode:characters_to_binary(X) end) ).
 
+-define('2bin'(X), (if is_binary(X) -> X;
+		       is_list(X) -> list_to_binary(X);
+		       X==undefined -> <<>>
+		    end) ).
+
+%% encoding macros
+-define('E...'(X),    ?'2bin'(X)/binary ).
+-define(Eboolean(X),  ?BOOLEAN(case X of
+				   true -> ?TRUE;
+				   false -> ?FALSE
+			       end) ).
+-define(Ebyte(X),        ?BYTE(X) ).
+-define(Euint32(X),      ?UINT32(X) ).
+-define(Estring(X),      ?STRING(?'2bin'(X)) ).
+-define(Estring_utf8(X), ?string_utf8(X)/binary ).
+-define(Ename_list(X),   ?STRING(ssh_bits:name_list(X)) ).
+-define(Empint(X),       (ssh_bits:mpint(X))/binary ).
+-define(Ebinary(X),      ?STRING(X) ).
+
 %% Cipher details
 -define(SSH_CIPHER_NONE, 0).
 -define(SSH_CIPHER_3DES, 3).
diff --git a/lib/ssh/src/ssh_message.erl b/lib/ssh/src/ssh_message.erl
index d95e58c1bb..7c86a81108 100644
--- a/lib/ssh/src/ssh_message.erl
+++ b/lib/ssh/src/ssh_message.erl
@@ -34,24 +34,6 @@
 
 -export([dbg_trace/3]).
 
--define('2bin'(X), (if is_binary(X) -> X;
-		       is_list(X) -> list_to_binary(X);
-		       X==undefined -> <<>>
-		    end) ).
-
--define('E...'(X),    ?'2bin'(X)/binary ).
--define(Eboolean(X),  ?BOOLEAN(case X of
-				   true -> ?TRUE;
-				   false -> ?FALSE
-			       end) ).
--define(Ebyte(X),        ?BYTE(X) ).
--define(Euint32(X),      ?UINT32(X) ).
--define(Estring(X),      ?STRING(?'2bin'(X)) ).
--define(Estring_utf8(X), ?string_utf8(X)/binary ).
--define(Ename_list(X),   ?STRING(ssh_bits:name_list(X)) ).
--define(Empint(X),       (ssh_bits:mpint(X))/binary ).
--define(Ebinary(X),      ?STRING(X) ).
-
 ucl(B) ->
     try unicode:characters_to_list(B) of
 	L when is_list(L) -> L;
diff --git a/lib/ssh/src/ssh_transport.erl b/lib/ssh/src/ssh_transport.erl
index eaab13433a..a85926354e 100644
--- a/lib/ssh/src/ssh_transport.erl
+++ b/lib/ssh/src/ssh_transport.erl
@@ -61,14 +61,6 @@
 -export([pack/3, adjust_algs_for_peer_version/2]).
 -export([decompress/2,  decrypt_blocks/3, is_valid_mac/3 ]). % FIXME: remove
 
--define(Estring(X), ?STRING((if is_binary(X) -> X;
-				is_list(X) -> list_to_binary(X);
-				X==undefined -> <<>>
-			     end))).
--define(Empint(X),     (ssh_bits:mpint(X))/binary ).
--define(Ebinary(X),    ?STRING(X) ).
--define(Euint32(X),   ?UINT32(X) ).
-
 %%%----------------------------------------------------------------------------
 %%%
 %%% There is a difference between supported and default algorithms. The
-- 
2.16.4

openSUSE Build Service is sponsored by