summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2013-05-04 22:03:59 +0200
committerNicholas Clark <nick@ccl4.org>2013-05-20 21:19:42 +0200
commit8e2d7c446d5ab31e6c8e661a3c17f0f0b199d525 (patch)
treeb2040d4be9d29967368829dda6867005ba78ff5b /pp_sys.c
parent260c6fee6deba90b42b0734fbdea2fea1d69c9bc (diff)
downloadperl-8e2d7c446d5ab31e6c8e661a3c17f0f0b199d525.tar.gz
Provide ntohl, ntohs, htonl and htons no-op macros on big endian systems.
This means that there are always macros or functions for ntohl, ntohs, htonl and htons available, so eliminate use of HAS_NTOHL etc, and unconditionally compile the code that it was protecting. However, as code on CPAN is using these guard macros, define all of them in perl.h (Technically the 4 are not quite no-ops, as they truncate their values to 32 or 16 bits, to be consistent with the implementations for platforms which need re-ordering.)
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c10
1 files changed, 0 insertions, 10 deletions
diff --git a/pp_sys.c b/pp_sys.c
index 04ccddb9ab..9458d2e767 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -4942,9 +4942,7 @@ PP(pp_gservent)
#ifdef HAS_GETSERVBYPORT
const char * const proto = POPpbytex;
unsigned short port = (unsigned short)POPu;
-#ifdef HAS_HTONS
port = PerlSock_htons(port);
-#endif
sent = PerlSock_getservbyport(port, (proto && !*proto) ? NULL : proto);
#else
DIE(aTHX_ PL_no_sock_func, "getservbyport");
@@ -4962,11 +4960,7 @@ PP(pp_gservent)
PUSHs(sv = sv_newmortal());
if (sent) {
if (which == OP_GSBYNAME) {
-#ifdef HAS_NTOHS
sv_setiv(sv, (IV)PerlSock_ntohs(sent->s_port));
-#else
- sv_setiv(sv, (IV)(sent->s_port));
-#endif
}
else
sv_setpv(sv, sent->s_name);
@@ -4977,11 +4971,7 @@ PP(pp_gservent)
if (sent) {
mPUSHs(newSVpv(sent->s_name, 0));
PUSHs(space_join_names_mortal(sent->s_aliases));
-#ifdef HAS_NTOHS
mPUSHi(PerlSock_ntohs(sent->s_port));
-#else
- mPUSHi(sent->s_port);
-#endif
mPUSHs(newSVpv(sent->s_proto, 0));
}