Browse code

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

Henning Westerholt authored on 10/04/2018 05:34:36
Showing 1 changed files
... ...
@@ -71,6 +71,7 @@ int redisc_init(void)
71 71
 	char addr[256], pass[256], unix_sock_path[256], sentinel_group[256];
72 72
 
73 73
 	unsigned int port, db, sock = 0, haspass = 0, sentinel_master = 1;
74
+	int i, row;
74 75
 	redisc_server_t *rsrv=NULL;
75 76
 	param_t *pit = NULL;
76 77
 	struct timeval tv_conn;
... ...
@@ -138,7 +139,7 @@ int redisc_init(void)
138 139
 		// if sentinels are provided, we need to connect to them and retrieve the redis server
139 140
 		// address / port
140 141
 		if(sentinels_count > 0) {
141
-			for(int i= 0; i< sentinels_count; i++) {
142
+			for(i= 0; i< sentinels_count; i++) {
142 143
 				char *sentinelAddr = sentinels[i];
143 144
 				char *pos;
144 145
 				redisContext *redis;
... ...
@@ -166,10 +167,10 @@ int redisc_init(void)
166 167
 						res = redisCommand(redis, "SENTINEL slaves %s", sentinel_group);
167 168
 						if( res && (res->type == REDIS_REPLY_ARRAY) ) {
168 169
 							
169
-							for(int row = 0; row< res->elements; row++){
170
+							for(row = 0; row< res->elements; row++){
170 171
 								res2 = res->element[row];
171 172
 								
172
-								for(int i= 0; i< res2->elements; i+= 2) {
173
+								for(i= 0; i< res2->elements; i+= 2) {
173 174
 									if( strncmp(res2->element[i]->str, "ip", 2) == 0 ) {
174 175
 										strncpy(addr, res2->element[i+1]->str, res2->element[i+1]->len);
175 176
 										addr[res2->element[i+1]->len] = '\0';