misc. cleanup.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@313 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2006-01-09 22:30:58 +00:00
parent 21baa6630b
commit cf661fbaca
3 changed files with 5 additions and 69 deletions

6
TODO
View File

@ -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.

View File

@ -39,13 +39,13 @@
extern "C" {
#endif
//Need to include this before any other includes (MSVC Bug)
#include <switch_platform.h>
#ifndef WIN32
#include <config.h>
#endif
//Need to include this before any other includes (MSVC Bug)
#include <switch_platform.h>
#include <assert.h>
#include <switch_version.h>

View File

@ -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