Index: src/OFExceptions.m ================================================================== --- src/OFExceptions.m +++ src/OFExceptions.m @@ -15,44 +15,44 @@ #include #include #include #import -#ifdef __objc_INCLUDE_GNU -#define SEL_NAME(x) sel_get_name(x) +#ifdef OF_APPLE_RUNTIME +# import +# define SEL_NAME(x) sel_getName(x) #else -#import -#define SEL_NAME(x) sel_getName(x) +# define SEL_NAME(x) sel_get_name(x) #endif #import "OFExceptions.h" #import "OFTCPSocket.h" #ifndef _WIN32 -#include -#define GET_ERR errno -#ifndef HAVE_GETADDRINFO -#define GET_AT_ERR h_errno -#else -#define GET_AT_ERR errno -#endif -#define GET_SOCK_ERR errno -#define ERRFMT "Error string was: %s" -#define ERRPARAM strerror(err) -#ifndef HAVE_GETADDRINFO -#define AT_ERRPARAM hstrerror(err) -#else -#define AT_ERRPARAM strerror(err) -#endif -#else -#include -#define GET_ERR GetLastError() -#define GET_AT_ERR WSAGetLastError() -#define GET_SOCK_ERR WSAGetLastError() -#define ERRFMT "Error code was: %d" -#define ERRPARAM err -#define AT_ERRPARAM err +# include +# define GET_ERR errno +# ifndef HAVE_GETADDRINFO +# define GET_AT_ERR h_errno +# else +# define GET_AT_ERR errno +# endif +# define GET_SOCK_ERR errno +# define ERRFMT "Error string was: %s" +# define ERRPARAM strerror(err) +# ifndef HAVE_GETADDRINFO +# define AT_ERRPARAM hstrerror(err) +# else +# define AT_ERRPARAM strerror(err) +# endif +#else +# include +# define GET_ERR GetLastError() +# define GET_AT_ERR WSAGetLastError() +# define GET_SOCK_ERR WSAGetLastError() +# define ERRFMT "Error code was: %d" +# define ERRPARAM err +# define AT_ERRPARAM err #endif #import "asprintf.h" @implementation OFAllocFailedException Index: src/OFMacros.h ================================================================== --- src/OFMacros.h +++ src/OFMacros.h @@ -13,40 +13,40 @@ #include #include #ifdef __GNUC__ -#define OF_INLINE inline __attribute__((always_inline)) -#define OF_LIKELY(cond) __builtin_expect(!!(cond), 1) -#define OF_UNLIKELY(cond) __builtin_expect(!!(cond), 0) +# define OF_INLINE inline __attribute__((always_inline)) +# define OF_LIKELY(cond) __builtin_expect(!!(cond), 1) +# define OF_UNLIKELY(cond) __builtin_expect(!!(cond), 0) #else -#define OF_INLINE inline -#define OF_LIKELY(cond) cond -#define OF_UNLIKELY(cond) cond +# define OF_INLINE inline +# define OF_LIKELY(cond) cond +# define OF_UNLIKELY(cond) cond #endif /* Required to build universal binaries on OS X */ #if __BIG_ENDIAN__ || __LITTLE_ENDIAN__ -#if __BIG_ENDIAN__ && __LITTLE_ENDIAN__ -#error __BIG_ENDIAN__ and __LITTLE_ENDIAN__ defined! -#endif -#undef OF_BIG_ENDIAN -#if __BIG_ENDIAN__ -#define OF_BIG_ENDIAN -#endif +# if __BIG_ENDIAN__ && __LITTLE_ENDIAN__ +# error __BIG_ENDIAN__ and __LITTLE_ENDIAN__ defined! +# endif +# undef OF_BIG_ENDIAN +# if __BIG_ENDIAN__ +# define OF_BIG_ENDIAN +# endif #endif #ifdef __GNUC__ -#if defined(__amd64__) || defined(__x86_64__) -#define OF_AMD64_ASM -#elif defined(__i386__) -#define OF_X86_ASM -#elif defined(__ppc__) || defined(__PPC__) -#define OF_PPC_ASM -#elif defined(__arm__) || defined(__ARM__) -#define OF_ARM_ASM -#endif +# if defined(__amd64__) || defined(__x86_64__) +# define OF_AMD64_ASM +# elif defined(__i386__) +# define OF_X86_ASM +# elif defined(__ppc__) || defined(__PPC__) +# define OF_PPC_ASM +# elif defined(__arm__) || defined(__ARM__) +# define OF_ARM_ASM +# endif #endif #define OF_BSWAP16_CONST(i) \ (((uint16_t)i & UINT16_C(0xFF00)) >> 8 | \ ((uint16_t)i & UINT16_C(0x00FF)) << 8) @@ -114,20 +114,20 @@ #endif return i; } #ifdef __GNUC__ -#define OF_BSWAP16(i) \ +# define OF_BSWAP16(i) \ (__builtin_constant_p(i) ? OF_BSWAP16_CONST(i) : OF_BSWAP16_NONCONST(i)) -#define OF_BSWAP32(i) \ +# define OF_BSWAP32(i) \ (__builtin_constant_p(i) ? OF_BSWAP32_CONST(i) : OF_BSWAP32_NONCONST(i)) -#define OF_BSWAP64(i) \ +# define OF_BSWAP64(i) \ (__builtin_constant_p(i) ? OF_BSWAP64_CONST(i) : OF_BSWAP64_NONCONST(i)) #else -#define OF_BSWAP16(i) OF_BSWAP16_CONST(i) -#define OF_BSWAP32(i) OF_BSWAP32_CONST(i) -#define OF_BSWAP64(i) OF_BSWAP64_CONST(i) +# define OF_BSWAP16(i) OF_BSWAP16_CONST(i) +# define OF_BSWAP32(i) OF_BSWAP32_CONST(i) +# define OF_BSWAP64(i) OF_BSWAP64_CONST(i) #endif static OF_INLINE void OF_BSWAP32_V(uint32_t *buf, size_t len) { @@ -136,25 +136,25 @@ buf++; } } #ifdef OF_BIG_ENDIAN -#define OF_BSWAP16_IF_BE(i) OF_BSWAP16(i) -#define OF_BSWAP32_IF_BE(i) OF_BSWAP32(i) -#define OF_BSWAP64_IF_BE(i) OF_BSWAP64(i) -#define OF_BSWAP16_IF_LE(i) i -#define OF_BSWAP32_IF_LE(i) i -#define OF_BSWAP64_IF_LE(i) i -#define OF_BSWAP32_V_IF_BE(buf, len) OF_BSWAP32_V(buf, len) +# define OF_BSWAP16_IF_BE(i) OF_BSWAP16(i) +# define OF_BSWAP32_IF_BE(i) OF_BSWAP32(i) +# define OF_BSWAP64_IF_BE(i) OF_BSWAP64(i) +# define OF_BSWAP16_IF_LE(i) i +# define OF_BSWAP32_IF_LE(i) i +# define OF_BSWAP64_IF_LE(i) i +# define OF_BSWAP32_V_IF_BE(buf, len) OF_BSWAP32_V(buf, len) #else -#define OF_BSWAP16_IF_BE(i) i -#define OF_BSWAP32_IF_BE(i) i -#define OF_BSWAP64_IF_BE(i) i -#define OF_BSWAP16_IF_LE(i) OF_BSWAP16(i) -#define OF_BSWAP32_IF_LE(i) OF_BSWAP32(i) -#define OF_BSWAP64_IF_LE(i) OF_BSWAP64(i) -#define OF_BSWAP32_V_IF_BE(buf, len) +# define OF_BSWAP16_IF_BE(i) i +# define OF_BSWAP32_IF_BE(i) i +# define OF_BSWAP64_IF_BE(i) i +# define OF_BSWAP16_IF_LE(i) OF_BSWAP16(i) +# define OF_BSWAP32_IF_LE(i) OF_BSWAP32(i) +# define OF_BSWAP64_IF_LE(i) OF_BSWAP64(i) +# define OF_BSWAP32_V_IF_BE(buf, len) #endif #define OF_ROL(val, bits) \ (((val) << (bits)) | ((val) >> (32 - (bits)))) Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -22,14 +22,14 @@ #import "OFExceptions.h" #import "OFMacros.h" #import #ifdef OF_APPLE_RUNTIME -#import +# import #endif #ifdef OF_GNU_RUNTIME -#import +# import #endif struct pre_ivar { void **memchunks; size_t memchunks_size; Index: src/OFTCPSocket.m ================================================================== --- src/OFTCPSocket.m +++ src/OFTCPSocket.m @@ -14,14 +14,14 @@ #include #include #include #ifndef HAVE_GETADDRINFO -#include -#ifndef _WIN32 -#include -#endif +# include +# ifndef _WIN32 +# include +# endif #endif #import "OFTCPSocket.h" #import "OFExceptions.h" Index: src/threading.h ================================================================== --- src/threading.h +++ src/threading.h @@ -22,15 +22,15 @@ typedef CRITICAL_SECTION of_mutex_t; typedef DWORD of_tlskey_t; #endif #ifndef _WIN32 -#define of_thread_is_current(t) pthread_equal(t, pthread_self()) -#define of_thread_current() pthread_self() +# define of_thread_is_current(t) pthread_equal(t, pthread_self()) +# define of_thread_current() pthread_self() #else -#define of_thread_is_current(t) (t == GetCurrentThread()) -#define of_thread_current() GetCurrentThread() +# define of_thread_is_current(t) (t == GetCurrentThread()) +# define of_thread_current() GetCurrentThread() #endif static OF_INLINE BOOL of_thread_new(of_thread_t *thread, id (*main)(id), id data) {