Skip to content

Commit a6ef508

Browse files
Remove ToMem macro. (#120)
We can always use `memcpy` to copy from a `hostent` struct to a `sockaddr_in` struct as they will not be overlapping.
1 parent 8b67b6b commit a6ef508

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

src/inet.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,6 @@
4848
#include "inlnPS2.h"
4949
#endif
5050

51-
#ifdef OS5
52-
#define ToMem memmove
53-
#else
54-
#define ToMem memcpy
55-
#endif /* !OS5 */
56-
5751
#define TCPhostlookup 0
5852
#define TCPservicelookup 1
5953
#define TCPsocket 2
@@ -126,7 +120,7 @@ LispPTR subr_TCP_ops(int op, LispPTR nameConn, LispPTR proto, LispPTR length, Li
126120
LispStringToCString(nameConn, namestring, 100);
127121
host = gethostbyname(namestring);
128122
if (!host) return (NIL);
129-
ToMem((char *)&farend.sin_addr, (char *)host->h_addr, host->h_length);
123+
memcpy((char *)&farend.sin_addr, (char *)host->h_addr, host->h_length);
130124
host_ok:
131125
sock = LispNumToCInt(proto);
132126
result = socket(AF_INET, SOCK_STREAM, 0);

src/rpc.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,6 @@
4646
#define MAX_HOSTNAME_LENGTH 100
4747
#define UDP_DATA_BLOCK_SIZE 1000
4848

49-
#ifdef OS5
50-
#define ToMem memmove
51-
#else
52-
#define ToMem memcpy
53-
#endif /* OS5 */
54-
5549
LispPTR rpc(LispPTR *args)
5650
{
5751
#ifndef DOS
@@ -130,7 +124,7 @@ LispPTR rpc(LispPTR *args)
130124
/* Resolve the host address. */
131125
if (hp) {
132126
sin1.sin_family = hp->h_addrtype;
133-
ToMem((caddr_t)&sin1.sin_addr, hp->h_addr, hp->h_length);
127+
memcpy((caddr_t)&sin1.sin_addr, hp->h_addr, hp->h_length);
134128
} else
135129
goto handle_error;
136130

0 commit comments

Comments
 (0)