File 0823-erl_interface-Remove-dead-code-in-not_used-directory.patch of Package erlang

From 578e3a83022a6dea5ec28addf8689db2259ad283 Mon Sep 17 00:00:00 2001
From: Sverker Eriksson <sverker@erlang.org>
Date: Wed, 27 Nov 2019 17:33:48 +0100
Subject: [PATCH] erl_interface: Remove dead code in not_used directory

---
 lib/erl_interface/src/not_used/ei_send.c     | 105 --------------------------
 lib/erl_interface/src/not_used/ei_send_reg.c | 108 ---------------------------
 lib/erl_interface/src/not_used/send_link.c   | 104 --------------------------
 lib/erl_interface/src/not_used/whereis.c     |  71 ------------------
 4 files changed, 388 deletions(-)
 delete mode 100644 lib/erl_interface/src/not_used/ei_send.c
 delete mode 100644 lib/erl_interface/src/not_used/ei_send_reg.c
 delete mode 100644 lib/erl_interface/src/not_used/send_link.c
 delete mode 100644 lib/erl_interface/src/not_used/whereis.c

diff --git a/lib/erl_interface/src/not_used/ei_send.c b/lib/erl_interface/src/not_used/ei_send.c
deleted file mode 100644
index 8071876677..0000000000
--- a/lib/erl_interface/src/not_used/ei_send.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * %CopyrightBegin%
- * 
- * Copyright Ericsson AB 2001-2016. All Rights Reserved.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * 
- * %CopyrightEnd%
- *
-
- */
-#ifdef __WIN32__
-#include <winsock2.h>
-#include <windows.h>
-#include <winbase.h>
-
-#elif VXWORKS
-#include <sys/types.h>
-#include <unistd.h>
-
-#else /* unix */
-#include <sys/types.h>
-#include <unistd.h>
-#include <sys/uio.h>
-#endif
-
-#include "eidef.h"
-#include "eiext.h"
-#include "ei_connect.h"
-#include "ei_internal.h"
-#include "putget.h"
-#include "ei_trace.h"
-#include "show_msg.h"
-
-/* FIXME this is not useed !!!!! */
-
-/* length (4), PASS_THROUGH (1), header, message */
-int ei_ei_send_encoded(ei_cnode* ec, int fd, const erlang_pid *to,
-		       const char *msg, int msglen)
-{
-  char *s, header[1200]; /* see size calculation below */
-  erlang_trace *token = NULL;
-  int index = 5; /* reserve 5 bytes for control message */
-#ifdef HAVE_WRITEV
-  struct iovec v[2];
-#endif
-
-  /* are we tracing? */
-  /* check that he can receive trace tokens first */
-  if (ei_distversion(fd) > 0)
-    token = ei_trace(0,(erlang_trace *)NULL);
-    
-  /* header = SEND, cookie, to                      max sizes: */
-  ei_encode_version(header,&index);                     /*   1 */
-  if (token) {
-    ei_encode_tuple_header(header,&index,4);            /*   2 */
-    ei_encode_long(header,&index,ERL_SEND_TT);          /*   2 */
-  } else {
-    ei_encode_tuple_header(header,&index,3);
-    ei_encode_long(header,&index,ERL_SEND); 
-  }
-  ei_encode_atom(header,&index, "" /*ei_getfdcookie(ec, fd)*/);       /* 258 */
-  ei_encode_pid(header,&index,to);                      /* 268 */
-    
-  if (token) ei_encode_trace(header,&index,token);      /* 534 */
-    
-  /* control message (precedes header actually) */
-  /* length = 1 ('p') + header len + message len */
-  s = header;
-  put32be(s, index + msglen - 4);                       /*   4 */
-  put8(s, ERL_PASS_THROUGH);                                /*   1 */
-  /*** sum: 1070 */
-    
-#ifdef DEBUG_DIST
-  if (ei_trace_distribution > 0) ei_show_sendmsg(stderr,header,msg);
-#endif
-    
-#ifdef HAVE_WRITEV
-    
-  v[0].iov_base = (char *)header;
-  v[0].iov_len = index;
-  v[1].iov_base = (char *)msg;
-  v[1].iov_len = msglen;
-    
-  if (writev(fd,v,2) != index+msglen) return -1;
-    
-#else  /* !HAVE_WRITEV */
-    
-  if (writesocket(fd,header,index) != index) return -1;
-  if (writesocket(fd,msg,msglen) != msglen) return -1;
-    
-#endif  /* !HAVE_WRITEV */
-    
-  return 0;
-}
diff --git a/lib/erl_interface/src/not_used/ei_send_reg.c b/lib/erl_interface/src/not_used/ei_send_reg.c
deleted file mode 100644
index ba9c7348f9..0000000000
--- a/lib/erl_interface/src/not_used/ei_send_reg.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * %CopyrightBegin%
- * 
- * Copyright Ericsson AB 2001-2016. All Rights Reserved.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * 
- * %CopyrightEnd%
- *
-
- */
-#ifdef __WIN32__
-#include <winsock2.h>
-#include <windows.h>
-#include <winbase.h>
-
-#elif VXWORKS
-#include <sys/types.h>
-#include <unistd.h>
-
-#else /* unix */
-#include <sys/types.h>
-#include <unistd.h>
-#include <sys/uio.h>
-#endif
-
-#include "eidef.h"
-#include "eiext.h"
-#include "ei_connect.h"
-#include "ei_internal.h"
-#include "putget.h"
-#include "ei_trace.h"
-#include "show_msg.h"
-
-/* FIXME this is not useed !!!!! */
-/* FIXME merge with ei_send.c */
-
-/* length (4), PASS_THROUGH (1), header, message */
-int ei_ei_send_reg_encoded(ei_cnode* ec, int fd, const erlang_pid *from,
-			   const char *to, const char *msg, int msglen)
-{
-  char *s, header[1400]; /* see size calculation below */
-  erlang_trace *token = NULL;
-  int index = 5; /* reserve 5 bytes for control message */
-#ifdef HAVE_WRITEV
-  struct iovec v[2];
-#endif
-
-  /* are we tracing? */
-  /* check that he can receive trace tokens first */
-  if (ei_distversion(fd) > 0)
-    token = ei_trace(0,(erlang_trace *)NULL);
-
-  /* header = REG_SEND, from, cookie, toname         max sizes: */
-  ei_encode_version(header,&index);                     /*   1 */
-  if (token) { 
-    ei_encode_tuple_header(header,&index,5);            /*   2 */
-    ei_encode_long(header,&index,ERL_REG_SEND_TT);      /*   2 */
-  } else {
-    ei_encode_tuple_header(header,&index,4);    
-    ei_encode_long(header,&index,ERL_REG_SEND); 
-  }
-  ei_encode_pid(header,&index,from);                    /* 268 */
-  ei_encode_atom(header,&index,"" /*ei_getfdcookie(ec, fd)*/ );       /* 258 */
-  ei_encode_atom(header,&index,to);                     /* 268 */
-
-  if (token) ei_encode_trace(header,&index,token);      /* 534 */
-
-  /* control message (precedes header actually) */
-  /* length = 1 ('p') + header len + message len */
-  s = header;
-  put32be(s, index + msglen - 4);                       /*   4 */
-  put8(s, ERL_PASS_THROUGH);                                /*   1 */
-                                                /*** sum: 1336 */
-  
-#ifdef DEBUG_DIST
-  if (ei_trace_distribution > 0) ei_show_sendmsg(stderr,header,msg);
-#endif
-  
-#ifdef HAVE_WRITEV
-
-  v[0].iov_base = (char *)header;
-  v[0].iov_len = index;
-  v[1].iov_base = (char *)msg;
-  v[1].iov_len = msglen;
-
-  if (writev(fd,v,2) != index+msglen) return -1;
-  
-#else
-  
-  /* no writev() */
-  if (writesocket(fd,header,index) != index) return -1;
-  if (writesocket(fd,msg,msglen) != msglen) return -1;
-
-#endif
-
-  return 0;
-}
diff --git a/lib/erl_interface/src/not_used/send_link.c b/lib/erl_interface/src/not_used/send_link.c
deleted file mode 100644
index 38fae27df4..0000000000
--- a/lib/erl_interface/src/not_used/send_link.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * %CopyrightBegin%
- * 
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * 
- * %CopyrightEnd%
- *
-
- */
-#ifdef __WIN32__
-#include <winsock2.h>
-#include <windows.h>
-#include <winbase.h>
-
-#elif VXWORKS
-#include <unistd.h>
-
-#else /* unix */
-#include <unistd.h>
-
-#endif
-
-#include <string.h>
-#include <stdlib.h>
-#include "eidef.h"
-#include "eiext.h"
-#include "eisend.h"
-#include "ei_internal.h"
-#include "putget.h"
-#include "erl_rport.h"
-
-
-/* this sends either link or unlink ('which' decides) */
-static int link_unlink(int fd, const erlang_pid *from, const erlang_pid *to,
-		       int which, unsigned ms)
-{
-  char msgbuf[EISMALLBUF];
-  char *s;
-  int index = 0;
-  int n;
-
-  index = 5;                                     /* max sizes: */
-  ei_encode_version(msgbuf,&index);                     /*   1 */
-  ei_encode_tuple_header(msgbuf,&index,3);
-  ei_encode_long(msgbuf,&index,which);
-  ei_encode_pid(msgbuf,&index,from);                    /* 268 */
-  ei_encode_pid(msgbuf,&index,to);                      /* 268 */
-
-  /* 5 byte header missing */
-  s = msgbuf;
-  put32be(s, index - 4);                                /*   4 */
-  put8(s, ERL_PASS_THROUGH);                            /*   1 */
-                                                  /* sum:  542 */
-
-
-#ifdef DEBUG_DIST
-  if (ei_trace_distribution > 1) ei_show_sendmsg(stderr,msgbuf,NULL);
-#endif
-
-  n = ei_write_fill_t(fd,msgbuf,index,ms); 
-
-  return (n==index ? 0 : -1);
-}
-
-/* FIXME not used? */
-#if 0
-/* use this to send a link */
-int ei_send_unlink(int fd, const erlang_pid *from, const erlang_pid *to)
-{
-  return link_unlink(fd, from, to, ERL_UNLINK,0);
-}
-
-/* use this to send an unlink */
-int ei_send_link(int fd, const erlang_pid *from, const erlang_pid *to)
-{
-  return link_unlink(fd, from, to, ERL_LINK,0);
-}
-/* use this to send a link */
-int ei_send_unlink_tmo(int fd, const erlang_pid *from, const erlang_pid *to,
-		       unsigned ms)
-{
-  return link_unlink(fd, from, to, ERL_UNLINK,ms);
-}
-
-/* use this to send an unlink */
-int ei_send_link_tmo(int fd, const erlang_pid *from, const erlang_pid *to,
-		     unsigned ms)
-{
-  return link_unlink(fd, from, to, ERL_LINK,ms);
-}
-#endif
diff --git a/lib/erl_interface/src/not_used/whereis.c b/lib/erl_interface/src/not_used/whereis.c
deleted file mode 100644
index 4072fa7b33..0000000000
--- a/lib/erl_interface/src/not_used/whereis.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * %CopyrightBegin%
- * 
- * Copyright Ericsson AB 1998-2016. All Rights Reserved.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * 
- * %CopyrightEnd%
- *
-
- */
-#ifdef __WIN32__
-#include <winsock2.h>
-#include <windows.h>
-#include <winbase.h>
-
-#elif VXWORKS
-#include <unistd.h>
-
-#else /* unix */
-#include <unistd.h>
-
-#endif
-
-#include <string.h>
-#include <stdlib.h>
-#include "erl_interface.h"
-#include "erl_connect.h"
-#include "erl_format.h"
-#include "erl_eterm.h"
-#include "erl_malloc.h"
-
-/* FIXME rewrite to ei functions */
-/* FIXME not used */
-
-erlang_pid *erl_whereis(int fd, const char *name)
-{
-  ETERM *reply;
-  ETERM *n;
-  /* FIXME problem for threaded ? */
-  static erlang_pid pid;
-  
-  n = erl_format("[~a]",name);
-  reply = erl_rpc(fd,"erlang","whereis",n);
-  erl_free_term(n);
-
-  if (reply && (ERL_IS_PID(reply))) {
-    char *node;
-    node =  ERL_PID_NODE(reply);
-    strcpy(pid.node,node);
-    pid.num = ERL_PID_NUMBER(reply);
-    pid.serial = ERL_PID_SERIAL(reply);
-    pid.creation = ERL_PID_CREATION(reply);
-    erl_free_term(reply);
-    return &pid;
-  }
-
-  if (reply) erl_free_term(reply);
-  return NULL;
-}
-
-- 
2.16.4

openSUSE Build Service is sponsored by