[Freeswitch-svn] [commit] r7398 - in freeswitch/trunk: libs/stfu src src/include
Freeswitch SVN
mikej at freeswitch.org
Sun Jan 27 20:11:26 EST 2008
Author: mikej
Date: Sun Jan 27 20:11:26 2008
New Revision: 7398
Modified:
freeswitch/trunk/libs/stfu/stfu.c
freeswitch/trunk/src/include/switch_apr.h
freeswitch/trunk/src/switch_apr.c
Log:
whitespace cleanup
Modified: freeswitch/trunk/libs/stfu/stfu.c
==============================================================================
--- freeswitch/trunk/libs/stfu/stfu.c (original)
+++ freeswitch/trunk/libs/stfu/stfu.c Sun Jan 27 20:11:26 2008
@@ -120,7 +120,7 @@
track[(d/10)]++;
}
}
-
+
last = this;
}
@@ -131,7 +131,6 @@
}
return most * 10;
-
}
static int16_t stfu_n_process(stfu_instance_t *i, stfu_queue_t *queue)
@@ -149,23 +148,22 @@
stfu_frame_t *frame;
size_t cplen = 0;
-
if (last || i->in_queue->array_len == i->in_queue->array_size) {
stfu_queue_t *other_queue;
-
+
if (i->out_queue->wr_len < i->out_queue->array_len) {
return STFU_IT_FAILED;
}
-
+
other_queue = i->in_queue;
i->in_queue = i->out_queue;
i->out_queue = other_queue;
-
+
i->in_queue->array_len = 0;
i->out_queue->wr_len = 0;
i->out_queue->last_index = 0;
i->miss_count = 0;
-
+
if (stfu_n_process(i, i->out_queue) < 0) {
return STFU_IT_FAILED;
}
@@ -177,7 +175,7 @@
if (last) {
return STFU_IM_DONE;
}
-
+
index = i->in_queue->array_len++;
frame = &i->in_queue->array[index];
@@ -198,7 +196,6 @@
uint32_t index, index2;
uint32_t should_have = 0;
stfu_frame_t *frame = NULL, *rframe = NULL;
-
if (((i->out_queue->wr_len == i->out_queue->array_len) || !i->out_queue->array_len)) {
return NULL;
@@ -216,7 +213,7 @@
}
frame = &i->out_queue->array[index];
-
+
if (frame->ts != should_have) {
unsigned int tried = 0;
for (index2 = 0; index2 < i->out_queue->array_len; index2++) {
@@ -249,7 +246,7 @@
i->out_queue->wr_len = i->out_queue->array_size;
return NULL;
}
-
+
i->last_ts = should_have;
rframe = &i->out_queue->int_frame;
rframe->dlen = i->out_queue->array[i->out_queue->last_index].dlen;
@@ -265,8 +262,8 @@
goto done;
}
}
-
- done:
+
+done:
if (rframe) {
i->out_queue->wr_len++;
@@ -279,4 +276,13 @@
return rframe;
}
-
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:nil
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
+ */
Modified: freeswitch/trunk/src/include/switch_apr.h
==============================================================================
--- freeswitch/trunk/src/include/switch_apr.h (original)
+++ freeswitch/trunk/src/include/switch_apr.h Sun Jan 27 20:11:26 2008
@@ -792,8 +792,22 @@
SWITCH_DECLARE(switch_status_t) switch_directory_exists(const char *dirname, switch_memory_pool_t *pool);
+/**
+* Create a new directory on the file system.
+* @param path the path for the directory to be created. (use / on all systems)
+* @param perm Permissions for the new direcoty.
+* @param pool the pool to use.
+*/
SWITCH_DECLARE(switch_status_t) switch_dir_make(const char *path, switch_fileperms_t perm,
switch_memory_pool_t *pool);
+
+/** Creates a new directory on the file system, but behaves like
+* 'mkdir -p'. Creates intermediate directories as required. No error
+* will be reported if PATH already exists.
+* @param path the path for the directory to be created. (use / on all systems)
+* @param perm Permissions for the new direcoty.
+* @param pool the pool to use.
+*/
SWITCH_DECLARE(switch_status_t) switch_dir_make_recursive(const char *path, switch_fileperms_t perm,
switch_memory_pool_t *pool);
Modified: freeswitch/trunk/src/switch_apr.c
==============================================================================
--- freeswitch/trunk/src/switch_apr.c (original)
+++ freeswitch/trunk/src/switch_apr.c Sun Jan 27 20:11:26 2008
@@ -73,36 +73,6 @@
apr_pool_clear(p);
}
-#if 0
-/* Hash tables */
-
-SWITCH_DECLARE(switch_hash_index_t *) switch_hash_first(switch_memory_pool_t *p, switch_hash_t * ht)
-{
- return apr_hash_first(p, ht);
-}
-
-SWITCH_DECLARE(switch_hash_index_t *) switch_hash_next(switch_hash_index_t * ht)
-{
- return apr_hash_next(ht);
-}
-
-SWITCH_DECLARE(void) switch_hash_this(switch_hash_index_t * hi, const void **key, switch_ssize_t *klen, void **val)
-{
- if (key) {
- *key = NULL;
- }
- if (val) {
- *val = NULL;
- }
- apr_hash_this(hi, key, klen, val);
-}
-
-SWITCH_DECLARE(switch_memory_pool_t *) switch_hash_pool_get(switch_hash_t * ht)
-{
- return apr_hash_pool_get(ht);
-}
-#endif
-
SWITCH_DECLARE(unsigned int) switch_hashfunc_default(const char *key, switch_ssize_t *klen)
{
return apr_hashfunc_default(key, klen);
@@ -259,7 +229,6 @@
return apr_time_exp_gmt((apr_time_exp_t *) result, input);
}
-
SWITCH_DECLARE(switch_status_t) switch_rfc822_date(char *date_str, switch_time_t t)
{
return apr_rfc822_date(date_str, t);
@@ -352,11 +321,11 @@
SWITCH_DECLARE(int) switch_file_printf(switch_file_t *thefile, const char *format, ...)
{
va_list ap;
- int ret;
+ int ret;
va_start(ap, format);
ret = apr_file_printf(thefile, format, ap);
va_end(ap);
- return ret;
+ return ret;
}
SWITCH_DECLARE(switch_status_t) switch_file_mktemp(switch_file_t **thefile, char *templ, int32_t flags, switch_memory_pool_t *pool)
@@ -384,7 +353,7 @@
if ((status = apr_dir_open(&dir_handle, dirname, pool)) == APR_SUCCESS) {
apr_dir_close(dir_handle);
}
-
+
if (our_pool) {
switch_core_destroy_memory_pool(&our_pool);
}
@@ -417,42 +386,12 @@
return status;
}
-/* #define SWITCH_FPROT_USETID 0x8000 /\**< Set user id *\/ */
-/* #define SWITCH_FPROT_UREAD 0x0400 /\**< Read by user *\/ */
-/* #define SWITCH_FPROT_UWRITE 0x0200 /\**< Write by user *\/ */
-/* #define SWITCH_FPROT_UEXECUTE 0x0100 /\**< Execute by user *\/ */
-
-/* #define SWITCH_FPROT_GSETID 0x4000 /\**< Set group id *\/ */
-/* #define SWITCH_FPROT_GREAD 0x0040 /\**< Read by group *\/ */
-/* #define SWITCH_FPROT_GWRITE 0x0020 /\**< Write by group *\/ */
-/* #define SWITCH_FPROT_GEXECUTE 0x0010 /\**< Execute by group *\/ */
-
-/* #define SWITCH_FPROT_WSTICKY 0x2000 /\**< Sticky bit *\/ */
-/* #define SWITCH_FPROT_WREAD 0x0004 /\**< Read by others *\/ */
-/* #define SWITCH_FPROT_WWRITE 0x0002 /\**< Write by others *\/ */
-/* #define SWITCH_FPROT_WEXECUTE 0x0001 /\**< Execute by others *\/ */
-
-/* #define SWITCH_FPROT_OS_DEFAULT 0x0FFF /\**< use OS's default permissions *\/ */
-
-/**
- * Create a new directory on the file system.
- * @param path the path for the directory to be created. (use / on all systems)
- * @param perm Permissions for the new direcoty.
- * @param pool the pool to use.
- */
SWITCH_DECLARE(switch_status_t) switch_dir_make(const char *path, switch_fileperms_t perm,
switch_memory_pool_t *pool)
{
return apr_dir_make(path, perm, pool);
}
-/** Creates a new directory on the file system, but behaves like
- * 'mkdir -p'. Creates intermediate directories as required. No error
- * will be reported if PATH already exists.
- * @param path the path for the directory to be created. (use / on all systems)
- * @param perm Permissions for the new direcoty.
- * @param pool the pool to use.
- */
SWITCH_DECLARE(switch_status_t) switch_dir_make_recursive(const char *path,
switch_fileperms_t perm,
switch_memory_pool_t *pool)
@@ -499,7 +438,7 @@
const char *fname = NULL;
apr_int32_t finfo_flags = APR_FINFO_DIRENT | APR_FINFO_TYPE | APR_FINFO_NAME;
const char *name;
-
+
while (apr_dir_read(&(thedir->finfo), finfo_flags, thedir->dir_handle) == SWITCH_STATUS_SUCCESS) {
if (thedir->finfo.filetype != APR_REG) {
@@ -509,7 +448,7 @@
if (!(name = thedir->finfo.fname)) {
name = thedir->finfo.name;
}
-
+
if (!name) {
continue;
}
@@ -604,10 +543,9 @@
}
wrote += need;
}
-
+
*len = wrote;
return status;
-
}
SWITCH_DECLARE(switch_status_t) switch_socket_sendto(switch_socket_t * sock, switch_sockaddr_t * where, int32_t flags, const char *buf, switch_size_t *len)
@@ -629,7 +567,6 @@
return apr_sockaddr_info_get(sa, hostname, family, port, flags, pool);
}
-
SWITCH_DECLARE(switch_status_t) switch_socket_opt_set(switch_socket_t * sock, int32_t opt, int32_t on)
{
return apr_socket_opt_set(sock, opt, on);
@@ -661,7 +598,6 @@
return get_addr(buf, len, &in->sa.sin.sin_addr);
}
-
SWITCH_DECLARE(uint16_t) switch_sockaddr_get_port(switch_sockaddr_t * sa)
{
return sa->port;
@@ -679,12 +615,11 @@
if ((r = apr_socket_recvfrom(from, sock, flags, buf, len)) == APR_SUCCESS) {
from->port = ntohs(from->sa.sin.sin_port);
/* from->ipaddr_ptr = &(from->sa.sin.sin_addr);
- * from->ipaddr_ptr = inet_ntoa(from->sa.sin.sin_addr);
- */
+ * from->ipaddr_ptr = inet_ntoa(from->sa.sin.sin_addr);
+ */
}
return r;
-
}
/* poll stubs */
@@ -776,7 +711,7 @@
do {
s = apr_queue_push(queue, data);
} while (s == APR_EINTR);
-
+
return s;
}
@@ -829,7 +764,6 @@
va_end(ap2);
return len;
-
#endif
}
More information about the Freeswitch-svn
mailing list