util: socketaddr: use #pragma once in headers

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Jonathon Jongsma 2019-06-18 11:13:03 -05:00 committed by Ján Tomko
parent a6d386eb87
commit 52e596cae7

View File

@ -16,17 +16,16 @@
* <http://www.gnu.org/licenses/>.
*/
#ifndef LIBVIRT_VIRSOCKETADDR_H
# define LIBVIRT_VIRSOCKETADDR_H
#pragma once
# include <netinet/in.h>
# include <sys/socket.h>
# ifdef HAVE_SYS_UN_H
# include <sys/un.h>
# endif
#include <netinet/in.h>
#include <sys/socket.h>
#ifdef HAVE_SYS_UN_H
# include <sys/un.h>
#endif
# include "internal.h"
# include "virautoclean.h"
#include "internal.h"
#include "virautoclean.h"
/* On architectures which lack these limits, define them (ie. Cygwin).
* Note that the libvirt code should be robust enough to handle the
@ -34,11 +33,11 @@
* length correctly in second argument to gethostname and by always
* using strncpy instead of strcpy).
*/
# ifndef INET_ADDRSTRLEN
# define INET_ADDRSTRLEN 16
# endif
#ifndef INET_ADDRSTRLEN
# define INET_ADDRSTRLEN 16
#endif
# define VIR_LOOPBACK_IPV4_ADDR "127.0.0.1"
#define VIR_LOOPBACK_IPV4_ADDR "127.0.0.1"
typedef struct {
union {
@ -46,27 +45,27 @@ typedef struct {
struct sockaddr_storage stor;
struct sockaddr_in inet4;
struct sockaddr_in6 inet6;
# ifdef HAVE_SYS_UN_H
#ifdef HAVE_SYS_UN_H
struct sockaddr_un un;
# endif
#endif
} data;
socklen_t len;
} virSocketAddr;
# define VIR_SOCKET_ADDR_VALID(s) \
#define VIR_SOCKET_ADDR_VALID(s) \
((s)->data.sa.sa_family != AF_UNSPEC)
# define VIR_SOCKET_ADDR_IS_FAMILY(s, f) \
#define VIR_SOCKET_ADDR_IS_FAMILY(s, f) \
((s)->data.sa.sa_family == f)
# define VIR_SOCKET_ADDR_FAMILY(s) \
#define VIR_SOCKET_ADDR_FAMILY(s) \
((s)->data.sa.sa_family)
# define VIR_SOCKET_ADDR_IPV4_ALL "0.0.0.0"
# define VIR_SOCKET_ADDR_IPV6_ALL "::"
#define VIR_SOCKET_ADDR_IPV4_ALL "0.0.0.0"
#define VIR_SOCKET_ADDR_IPV6_ALL "::"
# define VIR_SOCKET_ADDR_IPV4_ARPA "in-addr.arpa"
# define VIR_SOCKET_ADDR_IPV6_ARPA "ip6.arpa"
#define VIR_SOCKET_ADDR_IPV4_ARPA "in-addr.arpa"
#define VIR_SOCKET_ADDR_IPV6_ARPA "ip6.arpa"
typedef virSocketAddr *virSocketAddrPtr;
@ -161,5 +160,3 @@ int virSocketAddrPTRDomain(const virSocketAddr *addr,
void virSocketAddrFree(virSocketAddrPtr addr);
VIR_DEFINE_AUTOPTR_FUNC(virSocketAddr, virSocketAddrFree);
#endif /* LIBVIRT_VIRSOCKETADDR_H */