From cf661fbaca25072e94fa8ef1f2ab6d9c9c509bb6 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Mon, 9 Jan 2006 22:30:58 +0000 Subject: [PATCH] misc. cleanup. git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@313 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- TODO | 6 ++-- src/include/switch.h | 6 ++-- src/include/switch_utils.h | 62 -------------------------------------- 3 files changed, 5 insertions(+), 69 deletions(-) diff --git a/TODO b/TODO index 9719e42089..655d97f5cc 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,2 @@ -1. switch.h: Find a good home for the SWITCH_DECLARE stuff for win32 -2. MOD_WOOMERACHAN: #if 1==0 sectiton, convert to use switch_now instead of gettimeof day - SWITCH_SLEEP (should I be using switch_sleep or switch_yield where I changed from sleep and usleep) -3. if we don't need the timeval stuff let's get rid of it... it doesn't appear to be used. +1. MOD_WOOMERACHAN: #if 1==0 sectiton, convert to use switch_now instead of gettimeof day +2. switch_version.h. Change both msvc and unix scripts to create this to look for a VERSION file to generate this for tarball releases. \ No newline at end of file diff --git a/src/include/switch.h b/src/include/switch.h index 99572729aa..e33787e9a1 100644 --- a/src/include/switch.h +++ b/src/include/switch.h @@ -39,13 +39,13 @@ extern "C" { #endif +//Need to include this before any other includes (MSVC Bug) +#include + #ifndef WIN32 #include #endif -//Need to include this before any other includes (MSVC Bug) -#include - #include #include diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index bc7b85af9b..6cafab3a59 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -51,17 +51,6 @@ extern "C" { #define vsnprintf apr_vsnprintf #endif -#ifdef HAVE_TIMEVAL_STRUCT -extern struct timeval tv; -#ifdef WIN32 -typedef long switch_timeval_t; -typedef long switch_suseconds_t; -#else -typedef typeof(tv.tv_sec) switch_timeval_t; -typedef typeof(tv.tv_usec) switch_suseconds_t; -#endif -#endif - /*! \brief Duplicate a string */ @@ -151,59 +140,8 @@ SWITCH_DECLARE(int) switch_socket_waitfor(switch_pollfd_t *poll, int ms); SWITCH_DECLARE(char *) switch_cut_path(char *in); - -/* stuff below will probably be tossed soon */ - -#if !defined(switch_strdupa) && defined(__GNUC__) -# define switch_strdupa(s) \ - (__extension__ \ - ({ \ - __const char *__old = (s); \ - size_t __len = strlen (__old) + 1; \ - char *__new = (char *) __builtin_alloca (__len); \ - (char *) memcpy (__new, __old, __len); \ - })) -#endif - - -#ifdef HAVE_TIMEVAL_STRUCT -struct timeval switch_tvadd(struct timeval a, struct timeval b); -struct timeval switch_tvsub(struct timeval a, struct timeval b); - - -/*static struct timeval switch_tvnow(void) -{ - struct timeval t; - gettimeofday(&t, NULL); - return t; -} -*/ - -static struct timeval switch_tv(switch_timeval_t sec, switch_suseconds_t usec) -{ - struct timeval t; - t.tv_sec = sec; - t.tv_usec = usec; - return t; - -} - -static int switch_tvdiff_ms(struct timeval end, struct timeval start) -{ - /* the offset by 1,000,000 below is intentional... - it avoids differences in the way that division - is handled for positive and negative numbers, by ensuring - that the divisor is always positive - */ - return ((end.tv_sec - start.tv_sec) * 1000) + - (((1000000 + end.tv_usec - start.tv_usec) / 1000) - 1000); -} - -#endif - #ifdef __cplusplus } - #endif #endif