[sr-dev] git:master:278ff3a0: db_redis: declare variables at the beginning of the function (GH #2146)

Henning Westerholt hw at skalatan.de
Sun Nov 24 09:05:30 CET 2019


Module: kamailio
Branch: master
Commit: 278ff3a0265a3e3a4321d98555083c6e73669546
URL: https://github.com/kamailio/kamailio/commit/278ff3a0265a3e3a4321d98555083c6e73669546

Author: Henning Westerholt <hw at skalatan.de>
Committer: Henning Westerholt <hw at skalatan.de>
Date: 2019-11-24T09:03:27+01:00

db_redis: declare variables at the beginning of the function (GH #2146)

- declare variables at the beginning of the function (GH #2146)
- error message: redis_dbase.c: In function 'db_redis_scan_query_keys':
  redis_dbase.c:1086:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for (redis_key_t *set_key = set_keys; set_key; set_key = set_key->next)

---

Modified: src/modules/db_redis/redis_dbase.c

---

Diff:  https://github.com/kamailio/kamailio/commit/278ff3a0265a3e3a4321d98555083c6e73669546.diff
Patch: https://github.com/kamailio/kamailio/commit/278ff3a0265a3e3a4321d98555083c6e73669546.patch

---

diff --git a/src/modules/db_redis/redis_dbase.c b/src/modules/db_redis/redis_dbase.c
index 50d1a62b10..5061b8e447 100644
--- a/src/modules/db_redis/redis_dbase.c
+++ b/src/modules/db_redis/redis_dbase.c
@@ -923,6 +923,7 @@ static int db_redis_scan_query_keys(km_redis_con_t *con, const str *table_name,
     char *match = NULL;
     int ret;
     redisReply *reply = NULL;
+    redis_key_t *set_key = NULL;
     int i, j;
 
     *query_keys = NULL;
@@ -1083,7 +1084,7 @@ static int db_redis_scan_query_keys(km_redis_con_t *con, const str *table_name,
 
     ret = -1;
 
-    for (redis_key_t *set_key = set_keys; set_key; set_key = set_key->next) {
+    for (set_key = set_keys; set_key; set_key = set_key->next) {
         LM_DBG("pulling set members from key '%.*s'\n", set_key->key.len, set_key->key.s);
 
         redis_key_t *query_v = NULL;




More information about the sr-dev mailing list