summaryrefslogtreecommitdiffstats
path: root/lib/libc/net/ntohl.c
diff options
context:
space:
mode:
authortholo <tholo@openbsd.org>1996-12-12 03:19:55 +0000
committertholo <tholo@openbsd.org>1996-12-12 03:19:55 +0000
commit843f239316503e37abd866d72991c0527a249594 (patch)
treef890520e91404098d874b5ba86a6534f616656c1 /lib/libc/net/ntohl.c
parentRevert sane attach ordering for the time being (diff)
downloadwireguard-openbsd-843f239316503e37abd866d72991c0527a249594.tar.xz
wireguard-openbsd-843f239316503e37abd866d72991c0527a249594.zip
Update {hton,ntoh}[ls] argument and return types to match changes in
<machine/endian.h>
Diffstat (limited to 'lib/libc/net/ntohl.c')
-rw-r--r--lib/libc/net/ntohl.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/libc/net/ntohl.c b/lib/libc/net/ntohl.c
index 0947a071aeb..7d3e227e607 100644
--- a/lib/libc/net/ntohl.c
+++ b/lib/libc/net/ntohl.c
@@ -4,7 +4,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: ntohl.c,v 1.3 1996/08/19 08:29:33 tholo Exp $";
+static char *rcsid = "$OpenBSD: ntohl.c,v 1.4 1996/12/12 03:19:56 tholo Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -12,16 +12,14 @@ static char *rcsid = "$OpenBSD: ntohl.c,v 1.3 1996/08/19 08:29:33 tholo Exp $";
#undef ntohl
-unsigned long
+u_int32_t
ntohl(x)
- unsigned long x;
+ u_int32_t x;
{
- u_int32_t y = x;
-
#if BYTE_ORDER == LITTLE_ENDIAN
- u_char *s = (u_char *)&y;
+ u_char *s = (u_char *)&x;
return (u_int32_t)(s[0] << 24 | s[1] << 16 | s[2] << 8 | s[3]);
#else
- return y;
+ return x;
#endif
}