From b0afb8fe0ff1d87165af9df61501197a06240dda Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Sun, 28 Dec 2025 12:13:40 +0100 Subject: Sync with Gnulib stable-202507 code (a8ac9f9ce5) --- gl/arpa_inet.in.h | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 53 insertions(+), 5 deletions(-) (limited to 'gl/arpa_inet.in.h') diff --git a/gl/arpa_inet.in.h b/gl/arpa_inet.in.h index 523a448c..d7417bfd 100644 --- a/gl/arpa_inet.in.h +++ b/gl/arpa_inet.in.h @@ -1,6 +1,6 @@ /* A GNU-like . - Copyright (C) 2005-2006, 2008-2024 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2008-2025 Free Software Foundation, Inc. This file is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -60,6 +60,53 @@ # include #endif +#if !(@HAVE_DECL_HTONL@ || @HAVE_DECL_HTONS@ || @HAVE_DECL_NTOHL@ || @HAVE_DECL_NTOHS@) +# include +#endif + +_GL_INLINE_HEADER_BEGIN +#ifndef _GL_ARPA_INET_INLINE +# define _GL_ARPA_INET_INLINE _GL_INLINE +#endif + + +/* Host to network byte order. */ + +#if !@HAVE_DECL_HTONS@ +_GL_ARPA_INET_INLINE uint16_t +htons (uint16_t value) +{ + return htobe16 (value); +} +#endif + +#if !@HAVE_DECL_HTONL@ +_GL_ARPA_INET_INLINE uint32_t +htonl (uint32_t value) +{ + return htobe32 (value); +} +#endif + +/* Network to host byte order. */ + +#if !@HAVE_DECL_NTOHS@ +_GL_ARPA_INET_INLINE uint16_t +ntohs (uint16_t value) +{ + return htobe16 (value); +} +#endif + +#if !@HAVE_DECL_NTOHL@ +_GL_ARPA_INET_INLINE uint32_t +ntohl (uint32_t value) +{ + return htobe32 (value); +} +#endif + + /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ /* The definition of _GL_ARG_NONNULL is copied here. */ @@ -90,7 +137,7 @@ # endif _GL_FUNCDECL_RPL (inet_ntop, const char *, (int af, const void *restrict src, - char *restrict dst, socklen_t cnt) + char *restrict dst, socklen_t cnt), _GL_ARG_NONNULL ((2, 3))); _GL_CXXALIAS_RPL (inet_ntop, const char *, (int af, const void *restrict src, @@ -99,7 +146,7 @@ _GL_CXXALIAS_RPL (inet_ntop, const char *, # if !@HAVE_DECL_INET_NTOP@ _GL_FUNCDECL_SYS (inet_ntop, const char *, (int af, const void *restrict src, - char *restrict dst, socklen_t cnt) + char *restrict dst, socklen_t cnt), _GL_ARG_NONNULL ((2, 3))); # endif /* Need to cast, because on NonStop Kernel, the fourth parameter is @@ -126,14 +173,14 @@ _GL_WARN_ON_USE (inet_ntop, "inet_ntop is unportable - " # define inet_pton rpl_inet_pton # endif _GL_FUNCDECL_RPL (inet_pton, int, - (int af, const char *restrict src, void *restrict dst) + (int af, const char *restrict src, void *restrict dst), _GL_ARG_NONNULL ((2, 3))); _GL_CXXALIAS_RPL (inet_pton, int, (int af, const char *restrict src, void *restrict dst)); # else # if !@HAVE_DECL_INET_PTON@ _GL_FUNCDECL_SYS (inet_pton, int, - (int af, const char *restrict src, void *restrict dst) + (int af, const char *restrict src, void *restrict dst), _GL_ARG_NONNULL ((2, 3))); # endif _GL_CXXALIAS_SYS (inet_pton, int, @@ -150,6 +197,7 @@ _GL_WARN_ON_USE (inet_pton, "inet_pton is unportable - " # endif #endif +_GL_INLINE_HEADER_END #endif /* _@GUARD_PREFIX@_ARPA_INET_H */ #endif /* _@GUARD_PREFIX@_ARPA_INET_H */ -- cgit v1.2.3-74-g34f1