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

Author: Henning Westerholt <h...@kamailio.org>
Committer: Henning Westerholt <h...@kamailio.org>
Date: 2018-04-10T07:34:36+02:00

ndb_redis: fix error introduced commit in 95cfa343857e4: 'for' loop initial 
decl.

- fix error related to sentinel patch, introduced in commit 95cfa343857e4
- error: 'for' loop initial declarations are only allowed in C99 mode

---

Modified: src/modules/ndb_redis/redis_client.c

---

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

---

diff --git a/src/modules/ndb_redis/redis_client.c 
b/src/modules/ndb_redis/redis_client.c
index b92239ab74..bbf57e1e79 100644
--- a/src/modules/ndb_redis/redis_client.c
+++ b/src/modules/ndb_redis/redis_client.c
@@ -71,6 +71,7 @@ int redisc_init(void)
        char addr[256], pass[256], unix_sock_path[256], sentinel_group[256];
 
        unsigned int port, db, sock = 0, haspass = 0, sentinel_master = 1;
+       int i, row;
        redisc_server_t *rsrv=NULL;
        param_t *pit = NULL;
        struct timeval tv_conn;
@@ -138,7 +139,7 @@ int redisc_init(void)
                // if sentinels are provided, we need to connect to them and 
retrieve the redis server
                // address / port
                if(sentinels_count > 0) {
-                       for(int i= 0; i< sentinels_count; i++) {
+                       for(i= 0; i< sentinels_count; i++) {
                                char *sentinelAddr = sentinels[i];
                                char *pos;
                                redisContext *redis;
@@ -166,10 +167,10 @@ int redisc_init(void)
                                                res = redisCommand(redis, 
"SENTINEL slaves %s", sentinel_group);
                                                if( res && (res->type == 
REDIS_REPLY_ARRAY) ) {
                                                        
-                                                       for(int row = 0; row< 
res->elements; row++){
+                                                       for(row = 0; row< 
res->elements; row++){
                                                                res2 = 
res->element[row];
                                                                
-                                                               for(int i= 0; 
i< res2->elements; i+= 2) {
+                                                               for(i= 0; i< 
res2->elements; i+= 2) {
                                                                        if( 
strncmp(res2->element[i]->str, "ip", 2) == 0 ) {
                                                                                
strncpy(addr, res2->element[i+1]->str, res2->element[i+1]->len);
                                                                                
addr[res2->element[i+1]->len] = '\0';


_______________________________________________
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to