static char *trim(char *str)
{
size_t len;
+ int i;
if (zstr(str)) {
return str;
len = strlen(str);
/* strip whitespace from front */
- for (int i = 0; i < len; i++) {
+ for (i = 0; i < len; i++) {
if (!isspace(str[i])) {
str = &str[i];
len -= i;
}
/* strip whitespace from end */
- for (int i = len - 1; i >= 0; i--) {
+ for (i = len - 1; i >= 0; i--) {
if (!isspace(str[i])) {
break;
}
{
char *max_age_str;
switch_time_t max_age;
+ int i;
/* trim whitespace and check if empty */
data = trim(data);
if (zstr(max_age_str)) {
return;
}
- for (int i = 0; i < strlen(max_age_str); i++) {
+ for (i = 0; i < strlen(max_age_str); i++) {
if (!isdigit(max_age_str[i])) {
max_age_str[i] = '\0';
break;
*/
static void url_cache_clear(url_cache_t *cache, switch_core_session_t *session)
{
+ int i;
+
url_cache_lock(cache, session);
// remove each cached URL from the hash and the queue
- for (int i = 0; i < cache->queue.max_size; i++) {
+ for (i = 0; i < cache->queue.max_size; i++) {
cached_url_t *url = cache->queue.data[i];
if (url) {
switch_core_hash_delete(cache->map, url->url);
*/
static void setup_dir(url_cache_t *cache)
{
+ int i;
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "setting up %s\n", cache->location);
switch_dir_make_recursive(cache->location, SWITCH_DEFAULT_DIR_PERMS, cache->pool);
- for (int i = 0x00; i <= 0xff; i++) {
+ for (i = 0x00; i <= 0xff; i++) {
switch_dir_t *dir = NULL;
char *dirname = switch_mprintf("%s%s%02x", cache->location, SWITCH_PATH_SEPARATOR, i);
if (switch_dir_open(&dir, dirname, cache->pool) == SWITCH_STATUS_SUCCESS) {
SWITCH_MODULE_LOAD_FUNCTION(mod_http_cache_load)
{
switch_api_interface_t *api;
+ int i;
+
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
SWITCH_ADD_API(api, "http_get", "HTTP GET", http_cache_get, HTTP_GET_SYNTAX);
/* Start the prefetch threads */
switch_queue_create(&gcache.prefetch_queue, gcache.prefetch_queue_size, gcache.pool);
- for (int i = 0; i < gcache.prefetch_thread_count; i++) {
+ for (i = 0; i < gcache.prefetch_thread_count; i++) {
int started = 0;
switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL;