[pypy-commit] pypy default: htons and friends are macros on OpenBSD.

ltratt noreply at buildbot.pypy.org
Fri Jun 27 15:01:39 CEST 2014


Author: Laurence Tratt <laurie at tratt.net>
Branch: 
Changeset: r72253:cad6c535d3a5
Date: 2014-06-27 13:59 +0100
http://bitbucket.org/pypy/pypy/changeset/cad6c535d3a5/

Log:	htons and friends are macros on OpenBSD.

diff --git a/rpython/rlib/_rsocket_rffi.py b/rpython/rlib/_rsocket_rffi.py
--- a/rpython/rlib/_rsocket_rffi.py
+++ b/rpython/rlib/_rsocket_rffi.py
@@ -493,10 +493,16 @@
 getnameinfo = external('getnameinfo', [sockaddr_ptr, socklen_t, CCHARP,
                        size_t, CCHARP, size_t, rffi.INT], rffi.INT)
 
-htonl = external('htonl', [rffi.UINT], rffi.UINT, releasegil=False)
-htons = external('htons', [rffi.USHORT], rffi.USHORT, releasegil=False)
-ntohl = external('ntohl', [rffi.UINT], rffi.UINT, releasegil=False)
-ntohs = external('ntohs', [rffi.USHORT], rffi.USHORT, releasegil=False)
+if sys.platform.startswith("openbsd"):
+    htonl = external('htonl', [rffi.UINT], rffi.UINT, releasegil=False, macro=True)
+    htons = external('htons', [rffi.USHORT], rffi.USHORT, releasegil=False, macro=True)
+    ntohl = external('ntohl', [rffi.UINT], rffi.UINT, releasegil=False, macro=True)
+    ntohs = external('ntohs', [rffi.USHORT], rffi.USHORT, releasegil=False, macro=True)
+else:
+    htonl = external('htonl', [rffi.UINT], rffi.UINT, releasegil=False)
+    htons = external('htons', [rffi.USHORT], rffi.USHORT, releasegil=False)
+    ntohl = external('ntohl', [rffi.UINT], rffi.UINT, releasegil=False)
+    ntohs = external('ntohs', [rffi.USHORT], rffi.USHORT, releasegil=False)
 
 if _POSIX:
     inet_aton = external('inet_aton', [CCHARP, lltype.Ptr(in_addr)],


More information about the pypy-commit mailing list