Module: kamailio
Branch: master
Commit: 8ad2c3ab8af597e7567ed5ab04a5e3a16d74ad5d
URL:
https://github.com/kamailio/kamailio/commit/8ad2c3ab8af597e7567ed5ab04a5e3a…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-11-23T11:05:59+01:00
kafka: declare variables at the beginning of the function
- compiling with gcc 4.9 on debian jessie gives:
error: 'for' loop initial declarations are only allowed in C99 or C11 mode
---
Modified: src/modules/kafka/kfk.c
---
Diff:
https://github.com/kamailio/kamailio/commit/8ad2c3ab8af597e7567ed5ab04a5e3a…
Patch:
https://github.com/kamailio/kamailio/commit/8ad2c3ab8af597e7567ed5ab04a5e3a…
---
diff --git a/src/modules/kafka/kfk.c b/src/modules/kafka/kfk.c
index 859a4657b7..7f1dd8c87c 100644
--- a/src/modules/kafka/kfk.c
+++ b/src/modules/kafka/kfk.c
@@ -732,6 +732,8 @@ static int kfk_topic_exist(str *topic_name)
{
/* Where to receive metadata. */
const struct rd_kafka_metadata *metadatap = NULL;
+ int i;
+ int topic_found = 0; /* Topic not found by default. */
if (!topic_name || topic_name->len == 0 || topic_name->s == NULL) {
LM_ERR("Bad topic name\n");
@@ -747,9 +749,7 @@ static int kfk_topic_exist(str *topic_name)
}
/* List topics */
- int topic_found = 0; /* Topic not found by default. */
-
- for (int i=0; i<metadatap->topic_cnt; i++) {
+ for (i=0; i<metadatap->topic_cnt; i++) {
rd_kafka_metadata_topic_t *t = &metadatap->topics[i];
if (t->topic) {
LM_DBG("Metadata Topic: %s\n", t->topic);