Module: kamailio
Branch: master
Commit: a4dc8d6a6f42f6962fc9715e464f06be6c63fdc0
URL:
https://github.com/kamailio/kamailio/commit/a4dc8d6a6f42f6962fc9715e464f06b…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2018-02-16T08:50:27+01:00
db_redis: don't declare vars in for statement
- not compliant with C strict compile older than C99
---
Modified: src/modules/db_redis/redis_connection.c
Modified: src/modules/db_redis/redis_table.c
---
Diff:
https://github.com/kamailio/kamailio/commit/a4dc8d6a6f42f6962fc9715e464f06b…
Patch:
https://github.com/kamailio/kamailio/commit/a4dc8d6a6f42f6962fc9715e464f06b…
---
diff --git a/src/modules/db_redis/redis_connection.c
b/src/modules/db_redis/redis_connection.c
index c0e7a2b6b5..f143a07403 100644
--- a/src/modules/db_redis/redis_connection.c
+++ b/src/modules/db_redis/redis_connection.c
@@ -191,8 +191,10 @@ void db_redis_free_connection(struct pool_con* con) {
static void print_query(redis_key_t *query) {
+ redis_key_t *k;
+
LM_DBG("Query dump:\n");
- for (redis_key_t *k = query; k; k = k->next) {
+ for (k = query; k; k = k->next) {
LM_DBG(" %s\n", k->key.s);
}
}
diff --git a/src/modules/db_redis/redis_table.c b/src/modules/db_redis/redis_table.c
index 6c7e39a091..67ac2dc799 100644
--- a/src/modules/db_redis/redis_table.c
+++ b/src/modules/db_redis/redis_table.c
@@ -189,11 +189,12 @@ void db_redis_print_all_tables(km_redis_con_t *con) {
redis_table_t *table;
redis_key_t *key;
redis_type_t *type;
+ int i, j;
LM_DBG("dumping all redis tables:\n");
ht = &con->tables;
- for (int i = 0; i < ht->size; ++i) {
+ for (i = 0; i < ht->size; ++i) {
last = (&ht->table[i])->prev;
clist_foreach(&ht->table[i], he, next) {
LM_DBG(" table %.*s\n", he->key.len, he->key.s);
@@ -201,7 +202,7 @@ void db_redis_print_all_tables(km_redis_con_t *con) {
LM_DBG(" schema:\n");
col_ht = &table->columns;
- for (int j = 0; j < col_ht->size; ++j) {
+ for (j = 0; j < col_ht->size; ++j) {
col_last = (&col_ht->table[j])->prev;
clist_foreach(&col_ht->table[j], col_he, next) {
LM_DBG(" %.*s: %d\n",
@@ -239,6 +240,7 @@ void db_redis_print_table(km_redis_con_t *con, char *name) {
redis_table_t *table;
redis_key_t *key;
redis_type_t *type;
+ int j;
struct str_hash_table *col_ht;
struct str_hash_entry *col_he;
@@ -259,7 +261,7 @@ void db_redis_print_table(km_redis_con_t *con, char *name) {
LM_DBG(" schema:\n");
col_ht = &table->columns;
- for (int j = 0; j < col_ht->size; ++j) {
+ for (j = 0; j < col_ht->size; ++j) {
col_last = (&col_ht->table[j])->prev;
clist_foreach(&col_ht->table[j], col_he, next) {
LM_DBG(" %.*s: %d\n",
@@ -298,15 +300,16 @@ void db_redis_free_tables(km_redis_con_t *con) {
redis_table_t *table;
redis_key_t *key, *tmpkey;
redis_type_t *type, *tmptype;
+ int i, j;
ht = &con->tables;
- for (int i = 0; i < ht->size; ++i) {
+ for (i = 0; i < ht->size; ++i) {
last = (&ht->table[i])->prev;
clist_foreach(&ht->table[i], he, next) {
table = (redis_table_t*) he->u.p;
col_ht = &table->columns;
- for (int j = 0; j < col_ht->size; ++j) {
+ for (j = 0; j < col_ht->size; ++j) {
col_last = (&col_ht->table[j])->prev;
clist_foreach(&col_ht->table[j], col_he, next) {
pkg_free(col_he->key.s);