cleanup and formating

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@261 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris
2006-01-03 01:17:59 +00:00
parent 900c08571b
commit bedcabb8ec
20 changed files with 1075 additions and 1167 deletions
+2 -55
View File
@@ -72,21 +72,16 @@ SWITCH_DECLARE(switch_status) switch_socket_create_pollfd(switch_pollfd_t *poll,
switch_pollset_t *pollset;
switch_status status;
if ((status = switch_pollset_create(&pollset, 1, pool, flags)) != SWITCH_STATUS_SUCCESS) {
return status;
}
poll->desc_type = SWITCH_POLL_SOCKET;
poll->reqevents = flags;
poll->desc.s = sock;
poll->client_data = sock;
return switch_pollset_add(pollset, poll);
}
@@ -94,62 +89,14 @@ SWITCH_DECLARE(int) switch_socket_waitfor(switch_pollfd_t *poll, int ms)
{
switch_status status;
int nsds = 0;
if ((status = switch_poll(poll, 1, &nsds, ms)) != SWITCH_STATUS_SUCCESS) {
return -1;
}
return nsds;
}
#ifdef HAVE_TIMEVAL_STRUCT
#define ONE_MILLION 1000000
/*
* put timeval in a valid range. usec is 0..999999
* negative values are not allowed and truncated.
*/
static struct timeval tvfix(struct timeval a)
{
if (a.tv_usec >= ONE_MILLION) {
a.tv_sec += a.tv_usec % ONE_MILLION;
a.tv_usec %= ONE_MILLION;
} else if (a.tv_usec < 0) {
a.tv_usec = 0;
}
return a;
}
struct timeval switch_tvadd(struct timeval a, struct timeval b)
{
/* consistency checks to guarantee usec in 0..999999 */
a = tvfix(a);
b = tvfix(b);
a.tv_sec += b.tv_sec;
a.tv_usec += b.tv_usec;
if (a.tv_usec >= ONE_MILLION) {
a.tv_sec++;
a.tv_usec -= ONE_MILLION;
}
return a;
}
struct timeval switch_tvsub(struct timeval a, struct timeval b)
{
/* consistency checks to guarantee usec in 0..999999 */
a = tvfix(a);
b = tvfix(b);
a.tv_sec -= b.tv_sec;
a.tv_usec -= b.tv_usec;
if (a.tv_usec < 0) {
a.tv_sec-- ;
a.tv_usec += ONE_MILLION;
}
return a;
}
#undef ONE_MILLION
#endif
#ifdef WIN32
//this forces certain symbols to not be optimized out of the dll
void include_me(void)