From: Nick Ing-Simmons Date: Sat, 24 Jan 1998 10:37:56 +0000 (+0000) Subject: Get PerlXxx_yyyy() macro stuff to _compile_ on Solaris. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=31da6858e76569983828f43aec742159e881d627;p=p5sagit%2Fp5-mst-13.2.git Get PerlXxx_yyyy() macro stuff to _compile_ on Solaris. Ugh! ... Macros were unsuitable for declaring the functions, extra () round parameters removed - non-function forms of PerlXxx_yyyy() need to add () themselves. Need to include perlmem.h in util.c (at least) if not using Perl's malloc. p4raw-id: //depot/ansiperl@437 --- diff --git a/perlsock.h b/perlsock.h index 5c83082..e684fe2 100644 --- a/perlsock.h +++ b/perlsock.h @@ -3,35 +3,35 @@ #ifdef PERL_OBJECT #else -#define PerlSock_htonl(x) htonl((x)) -#define PerlSock_htons(x) htons((x)) -#define PerlSock_ntohl(x) ntohl((x)) -#define PerlSock_ntohs(x) ntohs((x)) -#define PerlSock_accept(s, a, l) accept((s), (a), (l)) -#define PerlSock_bind(s, n, l) bind((s), (n), (l)) -#define PerlSock_connect(s, n, l) connect((s), (n), (l)) -#define PerlSock_gethostbyaddr(a, l, t) gethostbyaddr((a), (l), (t)) -#define PerlSock_gethostbyname(n) gethostbyname((n)) +#define PerlSock_htonlx htonl(x) +#define PerlSock_htonsx htons(x) +#define PerlSock_ntohlx ntohl(x) +#define PerlSock_ntohsx ntohs(x) +#define PerlSock_accept(s, a, l) accept(s, a, l) +#define PerlSock_bind(s, n, l) bind(s, n, l) +#define PerlSock_connect(s, n, l) connect(s, n, l) +#define PerlSock_gethostbyaddr(a, l, t) gethostbyaddr(a, l, t) +#define PerlSock_gethostbyname(n) gethostbyname(n) #define PerlSock_gethostent() gethostent() -#define PerlSock_gethostname(n, l) gethostname((n), (l)) -#define PerlSock_getpeername(s, n, l) getpeername((s), (n), (l)) -#define PerlSock_getprotobyname(n) getprotobyname((n)) -#define PerlSock_getprotobynumber(n) getprotobynumber((n)) +#define PerlSock_gethostname(n, l) gethostname(n, l) +#define PerlSock_getpeername(s, n, l) getpeername(s, n, l) +#define PerlSock_getprotobyname(n) getprotobyname(n) +#define PerlSock_getprotobynumber(n) getprotobynumber(n) #define PerlSock_getprotoent() getprotoent() -#define PerlSock_getservbyname(n, p) getservbyname((n), (p)) -#define PerlSock_getservbyport(port, p) getservbyport((port), (p)) +#define PerlSock_getservbyname(n, p) getservbyname(n, p) +#define PerlSock_getservbyport(port, p) getservbyport(port, p) #define PerlSock_getservent() getservent() -#define PerlSock_getsockname(s, n, l) getsockname((s), (n), (l)) -#define PerlSock_getsockopt(s, l, n, v, i) getsockopt((s), (l), (n), (v), (i)) -#define PerlSock_listen(s, b) listen((s), (b)) -#define PerlSock_recvfrom(s, b, l, f, from, fromlen) recvfrom((s), (b), (l), (f), (from), (fromlen)) -#define PerlSock_select(n, r, w, e, t) select((n), (r), (w), (e), (t)) -#define PerlSock_send(s, b, l, f) send((s), (b), (l), (f)) -#define PerlSock_sendto(s, b, l, f, t, tlen) sendto((s), (b), (l), (f), (t), (tlen)) -#define PerlSock_setsockopt(s, l, n, v, len) setsockopt((s), (l), (n), (v), (len)) -#define PerlSock_shutdown(s, h) shutdown((s), (h)) -#define PerlSock_socket(a, t, p) socket((a), (t), (p)) -#define PerlSock_socketpair(a, t, p, f) socketpair((a), (t), (p), (f)) +#define PerlSock_getsockname(s, n, l) getsockname(s, n, l) +#define PerlSock_getsockopt(s, l, n, v, i) getsockopt(s, l, n, v, i) +#define PerlSock_listen(s, b) listen(s, b) +#define PerlSock_recvfrom(s, b, l, f, from, fromlen) recvfrom(s, b, l, f, from, fromlen) +#define PerlSock_select(n, r, w, e, t) select(n, r, w, e, t) +#define PerlSock_send(s, b, l, f) send(s, b, l, f) +#define PerlSock_sendto(s, b, l, f, t, tlen) sendto(s, b, l, f, t, tlen) +#define PerlSock_setsockopt(s, l, n, v, len) setsockopt(s, l, n, v, len) +#define PerlSock_shutdown(s, h) shutdown(s, h) +#define PerlSock_socket(a, t, p) socket(a, t, p) +#define PerlSock_socketpair(a, t, p, f) socketpair(a, t, p, f) #endif /* PERL_OBJECT */ #endif /* Include guard */ diff --git a/pp_sys.c b/pp_sys.c index 5307c60..a5de48b 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -3581,8 +3581,10 @@ PP(pp_ghostent) #if defined(HAS_GETHOSTENT) && !defined(DONT_DECLARE_STD) struct hostent *PerlSock_gethostbyname(const char *); struct hostent *PerlSock_gethostbyaddr(const Gethbadd_addr_t, Gethbadd_alen_t, int); +#ifndef PerlSock_gethostent struct hostent *PerlSock_gethostent(void); #endif +#endif struct hostent *hent; unsigned long len; @@ -3761,8 +3763,10 @@ PP(pp_gprotoent) #ifndef DONT_DECLARE_STD struct protoent *PerlSock_getprotobyname(const char *); struct protoent *PerlSock_getprotobynumber(int); +#ifndef PerlSock_getprotoent struct protoent *PerlSock_getprotoent(void); #endif +#endif struct protoent *pent; if (which == OP_GPBYNAME) @@ -3831,8 +3835,10 @@ PP(pp_gservent) #ifndef DONT_DECLARE_STD struct servent *PerlSock_getservbyname(const char *, const char *); struct servent *PerlSock_getservbynumber(); +#ifndef PerlSock_getservent struct servent *PerlSock_getservent(void); #endif +#endif struct servent *sent; if (which == OP_GSBYNAME) { diff --git a/util.c b/util.c index 683c90d..31827b0 100644 --- a/util.c +++ b/util.c @@ -14,6 +14,7 @@ #include "EXTERN.h" #include "perl.h" +#include "perlmem.h" #if !defined(NSIG) || defined(M_UNIX) || defined(M_XENIX) #include