From: Tilghman Lesher Date: Fri, 24 Sep 2010 03:20:24 +0000 (+0000) Subject: Solaris compatibility fixes X-Git-Tag: 1.4.38-rc1~54 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b94a0e14a22c53dee6d82f5a1a52e7d6eba7f9c9;p=thirdparty%2Fasterisk.git Solaris compatibility fixes git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@288636 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h index 750f56690c..fb00467826 100644 --- a/include/asterisk/channel.h +++ b/include/asterisk/channel.h @@ -1399,19 +1399,6 @@ static inline int ast_fdisset(struct pollfd *pfds, int fd, int max, int *start) return 0; } -#ifndef HAVE_TIMERSUB -static inline void timersub(struct timeval *tvend, struct timeval *tvstart, struct timeval *tvdiff) -{ - tvdiff->tv_sec = tvend->tv_sec - tvstart->tv_sec; - tvdiff->tv_usec = tvend->tv_usec - tvstart->tv_usec; - if (tvdiff->tv_usec < 0) { - tvdiff->tv_sec --; - tvdiff->tv_usec += 1000000; - } - -} -#endif - #define CHECK_BLOCKING(c) do { \ if (ast_test_flag(c, AST_FLAG_BLOCKING)) {\ if (option_debug) \ diff --git a/include/asterisk/compat.h b/include/asterisk/compat.h index d91ce4a1ac..2168f8c36f 100644 --- a/include/asterisk/compat.h +++ b/include/asterisk/compat.h @@ -62,6 +62,10 @@ int unsetenv(const char *name); int vasprintf(char **strp, const char *fmt, va_list ap); #endif +#ifndef HAVE_TIMERSUB +void timersub(struct timeval *tvend, struct timeval *tvstart, struct timeval *tvdiff); +#endif + #ifndef HAVE_STRLCAT size_t strlcat(char *dst, const char *src, size_t siz) attribute_deprecated; #endif diff --git a/main/asterisk.exports b/main/asterisk.exports index b503506068..61567310d4 100644 --- a/main/asterisk.exports +++ b/main/asterisk.exports @@ -38,6 +38,7 @@ asprintf; strtoq; getloadavg; + timersub; strlcat; strlcpy; local: diff --git a/main/strcompat.c b/main/strcompat.c index 243ef76cb0..2840c91909 100644 --- a/main/strcompat.c +++ b/main/strcompat.c @@ -172,6 +172,19 @@ int vasprintf(char **strp, const char *fmt, va_list ap) } #endif /* !defined(HAVE_VASPRINTF) && !defined(__AST_DEBUG_MALLOC) */ +#ifndef HAVE_TIMERSUB +void timersub(struct timeval *tvend, struct timeval *tvstart, struct timeval *tvdiff) +{ + tvdiff->tv_sec = tvend->tv_sec - tvstart->tv_sec; + tvdiff->tv_usec = tvend->tv_usec - tvstart->tv_usec; + if (tvdiff->tv_usec < 0) { + tvdiff->tv_sec --; + tvdiff->tv_usec += 1000000; + } + +} +#endif + /* * Based on Code from bsd-asprintf from OpenSSH * Copyright (c) 2004 Darren Tucker.