--- AnyEvent-FastPing/FastPing.xs 2009/03/29 20:07:03 1.4 +++ AnyEvent-FastPing/FastPing.xs 2009/07/03 09:26:19 1.5 @@ -1,11 +1,7 @@ -#define _POSIX_C_SOURCE 200112 -#define _XOPEN_SOURCE 600 -#define _LARGEFILE64_SOURCE 1 - -#ifdef __APPLE__ -# define IPV6 0 +#if defined(__linux) +# define ENABLE_IPV6 1 // if you get compilation problems try to disable IPv6 #else -# define IPV6 1 // if you get compilation problems try to disable IPv6 +# define ENABLE_IPV6 0 #endif #include "EXTERN.h" @@ -36,7 +32,7 @@ #ifdef __linux # include #endif -#if IPV6 +#if ENABLE_IPV6 # include #endif @@ -57,8 +53,8 @@ typedef double tstamp; -tstamp -NOW () +static tstamp +NOW (void) { struct timeval tv; gettimeofday (&tv, 0); @@ -168,7 +164,7 @@ { PKT pkt; struct sockaddr_in sa4; -#if IPV6 +#if ENABLE_IPV6 struct sockaddr_in6 sa6; #endif @@ -177,7 +173,7 @@ memset (&sa4, 0, sizeof (sa4)); sa4.sin_family = AF_INET; sa4.sin_port = 0; -#if IPV6 +#if ENABLE_IPV6 memset (&sa6, 0, sizeof (sa6)); sa6.sin6_family = AF_INET6; sa6.sin6_port = 0; @@ -262,7 +258,7 @@ } else { -#if IPV6 +#if ENABLE_IPV6 pkt.type = ICMP6_ECHO; memcpy (&sa6.sin6_addr, @@ -374,7 +370,7 @@ } #endif -#if IPV6 +#if ENABLE_IPV6 icmp6_fd = socket (AF_INET6, SOCK_RAW, IPPROTO_ICMPV6); fcntl (icmp6_fd, F_SETFL, O_NONBLOCK); # ifdef ICMP6_FILTER @@ -473,7 +469,7 @@ if (SvPOKp (lo) && SvPOKp (hi)) { if (SvCUR (lo) != SvCUR (hi)) - croak ("addresses in range must be of the same size (either 4 or 16 bytes)"); + croak ("all addresses in range must be of the same size (either 4 or 16 bytes)"); if (SvCUR (lo) == 4) { @@ -483,7 +479,7 @@ } else if (SvCUR (lo) == 16) { -#if IPV6 +#if ENABLE_IPV6 r->family = AF_INET6; memcpy (&r->lo, SvPVX (lo), sizeof (addr_t)); memcpy (&r->hi, SvPVX (hi), sizeof (addr_t)); @@ -492,7 +488,7 @@ #endif } else - croak ("addresses in range must be either 4 (IPv4) or 16 (IPV6) bytes in length"); + croak ("addresses in range must be either 4 (IPv4) or 16 (IPv6) bytes in length"); } else if (SvIOK (lo) && SvIOK (hi)) {