From 35f8072e5c9a17d364f88df72f0751f894689931 Mon Sep 17 00:00:00 2001 From: akr Date: Fri, 15 Feb 2013 22:53:59 +0000 Subject: [PATCH] preprocessor directives indented. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/socket/rubysocket.h | 144 +++++++++++++++++++++------------------- 1 file changed, 74 insertions(+), 70 deletions(-) diff --git a/ext/socket/rubysocket.h b/ext/socket/rubysocket.h index 28d50d13cc..ea225b8247 100644 --- a/ext/socket/rubysocket.h +++ b/ext/socket/rubysocket.h @@ -11,79 +11,81 @@ #include #ifdef HAVE_UNISTD_H -#include +# include #endif #ifdef HAVE_SYS_UIO_H -#include +# include #endif #ifdef HAVE_XTI_H -#include +# include #endif #ifndef _WIN32 -#if defined(__BEOS__) && !defined(__HAIKU__) && !defined(BONE) -# include -#else -# include -#endif -#include -#ifdef HAVE_NETINET_IN_SYSTM_H -# include -#endif -#ifdef HAVE_NETINET_TCP_H -# include -#endif -#ifdef HAVE_NETINET_UDP_H -# include -#endif -#ifdef HAVE_ARPA_INET_H -# include -#endif -#include +# if defined(__BEOS__) && !defined(__HAIKU__) && !defined(BONE) +# include +# else +# include +# endif +# include +# ifdef HAVE_NETINET_IN_SYSTM_H +# include +# endif +# ifdef HAVE_NETINET_TCP_H +# include +# endif +# ifdef HAVE_NETINET_UDP_H +# include +# endif +# ifdef HAVE_ARPA_INET_H +# include +# endif +# include #endif + #include + #ifdef HAVE_SYS_UN_H -#include +# include #endif #if defined(HAVE_FCNTL) -#ifdef HAVE_SYS_SELECT_H -#include -#endif -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_TIME_H -#include -#endif -#ifdef HAVE_FCNTL_H -#include -#endif +# ifdef HAVE_SYS_SELECT_H +# include +# endif +# ifdef HAVE_SYS_TYPES_H +# include +# endif +# ifdef HAVE_SYS_TIME_H +# include +# endif +# ifdef HAVE_FCNTL_H +# include +# endif #endif #ifdef HAVE_IFADDRS_H -#include +# include #endif #ifdef HAVE_SYS_IOCTL_H -#include +# include #endif #ifdef HAVE_SYS_SOCKIO_H -#include +# include #endif #ifdef HAVE_NET_IF_H -#include +# include #endif #ifdef HAVE_SYS_PARAM_H -#include +# include #endif #ifdef HAVE_SYS_UCRED_H -#include +# include #endif #ifdef HAVE_UCRED_H -#include +# include #endif #ifndef HAVE_TYPE_SOCKLEN_T @@ -91,7 +93,7 @@ typedef int socklen_t; #endif #ifndef EWOULDBLOCK -#define EWOULDBLOCK EAGAIN +# define EWOULDBLOCK EAGAIN #endif /* @@ -104,44 +106,45 @@ typedef int socklen_t; #define pseudo_AF_FTIP pseudo_AF_RTIP #ifndef HAVE_GETADDRINFO -#include "addrinfo.h" +# include "addrinfo.h" #endif + #include "sockport.h" #ifndef NI_MAXHOST -# define NI_MAXHOST 1025 +# define NI_MAXHOST 1025 #endif #ifndef NI_MAXSERV -# define NI_MAXSERV 32 +# define NI_MAXSERV 32 #endif #ifdef AF_INET6 -# define IS_IP_FAMILY(af) ((af) == AF_INET || (af) == AF_INET6) +# define IS_IP_FAMILY(af) ((af) == AF_INET || (af) == AF_INET6) #else -# define IS_IP_FAMILY(af) ((af) == AF_INET) +# define IS_IP_FAMILY(af) ((af) == AF_INET) #endif #ifndef IN6_IS_ADDR_UNIQUE_LOCAL -# define IN6_IS_ADDR_UNIQUE_LOCAL(a) (((a)->s6_addr[0] == 0xfc) || ((a)->s6_addr[0] == 0xfd)) +# define IN6_IS_ADDR_UNIQUE_LOCAL(a) (((a)->s6_addr[0] == 0xfc) || ((a)->s6_addr[0] == 0xfd)) #endif #ifndef HAVE_TYPE_STRUCT_SOCKADDR_STORAGE /* * RFC 2553: protocol-independent placeholder for socket addresses */ -#define _SS_MAXSIZE 128 -#define _SS_ALIGNSIZE (sizeof(double)) -#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(unsigned char) * 2) -#define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(unsigned char) * 2 - \ +# define _SS_MAXSIZE 128 +# define _SS_ALIGNSIZE (sizeof(double)) +# define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(unsigned char) * 2) +# define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(unsigned char) * 2 - \ _SS_PAD1SIZE - _SS_ALIGNSIZE) struct sockaddr_storage { -#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN +# ifdef HAVE_STRUCT_SOCKADDR_SA_LEN unsigned char ss_len; /* address length */ unsigned char ss_family; /* address family */ -#else +# else unsigned short ss_family; -#endif +# endif char __ss_pad1[_SS_PAD1SIZE]; double __ss_align; /* force desired structure storage alignment */ char __ss_pad2[_SS_PAD2SIZE]; @@ -154,22 +157,22 @@ struct sockaddr_storage { * aligns up to __darwin_size_t which is 64bit, but CMSG_DATA is * 32bit-aligned. */ -#undef __DARWIN_ALIGNBYTES -#define __DARWIN_ALIGNBYTES (sizeof(unsigned int) - 1) +# undef __DARWIN_ALIGNBYTES +# define __DARWIN_ALIGNBYTES (sizeof(unsigned int) - 1) #endif #if defined(_AIX) -#ifndef CMSG_SPACE -# define CMSG_SPACE(len) (_CMSG_ALIGN(sizeof(struct cmsghdr)) + _CMSG_ALIGN(len)) -#endif -#ifndef CMSG_LEN -# define CMSG_LEN(len) (_CMSG_ALIGN(sizeof(struct cmsghdr)) + (len)) -#endif +# ifndef CMSG_SPACE +# define CMSG_SPACE(len) (_CMSG_ALIGN(sizeof(struct cmsghdr)) + _CMSG_ALIGN(len)) +# endif +# ifndef CMSG_LEN +# define CMSG_LEN(len) (_CMSG_ALIGN(sizeof(struct cmsghdr)) + (len)) +# endif #endif #ifdef __BEOS__ -#undef close -#define close closesocket +# undef close +# define close closesocket #endif #define INET_CLIENT 0 @@ -196,12 +199,12 @@ extern VALUE rb_eSocket; #ifdef SOCKS extern VALUE rb_cSOCKSSocket; -#ifdef SOCKS5 -#include -#else +# ifdef SOCKS5 +# include +# else void SOCKSinit(); int Rconnect(); -#endif +# endif #endif #include "constdefs.h" @@ -289,6 +292,7 @@ VALUE rsock_bsock_sendmsg_nonblock(int argc, VALUE *argv, VALUE sock); #define rsock_bsock_sendmsg rb_f_notimplement #define rsock_bsock_sendmsg_nonblock rb_f_notimplement #endif + #if defined(HAVE_RECVMSG) VALUE rsock_bsock_recvmsg(int argc, VALUE *argv, VALUE sock); VALUE rsock_bsock_recvmsg_nonblock(int argc, VALUE *argv, VALUE sock);