X-Git-Url: https://git.tcpdump.org/libpcap/blobdiff_plain/28e59ef688d13addc6fb5df8362ad61ac6ce826d..09b51d326c38ea8e10ce4da09c09d50e08c5aeb8:/portability.h diff --git a/portability.h b/portability.h index 39e1583b..84d0778a 100644 --- a/portability.h +++ b/portability.h @@ -83,8 +83,6 @@ extern "C" { #endif #ifdef _MSC_VER - #define isascii __isascii - /* * If has been included, and _DEBUG is defined, and * __STDC__ is zero, will define strdup() to call @@ -114,6 +112,30 @@ extern int pcap_asprintf(char **, PCAP_FORMAT_STRING(const char *), ...) extern int pcap_vasprintf(char **, const char *, va_list ap); #endif +/* For Solaris before 11. */ +#ifndef timeradd +#define timeradd(a, b, result) \ + do { \ + (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \ + (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \ + if ((result)->tv_usec >= 1000000) { \ + ++(result)->tv_sec; \ + (result)->tv_usec -= 1000000; \ + } \ + } while (0) +#endif /* timeradd */ +#ifndef timersub +#define timersub(a, b, result) \ + do { \ + (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ + (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ + if ((result)->tv_usec < 0) { \ + --(result)->tv_sec; \ + (result)->tv_usec += 1000000; \ + } \ + } while (0) +#endif /* timersub */ + #ifdef HAVE_STRTOK_R #define pcap_strtok_r strtok_r #else