[sr-dev] git:master:f677dea5: lcr: fix build

Victor Seva linuxmaniac at torreviejawireless.org
Thu Oct 14 15:19:38 CEST 2021


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

Author: Victor Seva <linuxmaniac at torreviejawireless.org>
Committer: Victor Seva <linuxmaniac at torreviejawireless.org>
Date: 2021-10-14T15:16:52+02:00

lcr: fix build

> lcr_mod.c: In function 'find_gateway_by_ip_and_port':
> lcr_mod.c:930:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
>   for (int i = 1; i <= gws[0].ip_addr.u.addr32[0]; i++) {
>   ^
> lcr_mod.c:930:2: note: use option -std=c99, -std=gnu99,   -std=c11 or -std=gnu11 to compile your code
> ../../Makefile.rules:100: recipe for target 'lcr_mod.o' failed
> make[3]: *** [lcr_mod.o] Error 1

---

Modified: src/modules/lcr/lcr_mod.c

---

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

---

diff --git a/src/modules/lcr/lcr_mod.c b/src/modules/lcr/lcr_mod.c
index d796c08c2c..630593bd36 100644
--- a/src/modules/lcr/lcr_mod.c
+++ b/src/modules/lcr/lcr_mod.c
@@ -925,9 +925,9 @@ static int comp_gws(const void *_g1, const void *_g2)
  * Compare a gateway using IP address and the src port
  */
 static struct gw_info * find_gateway_by_ip_and_port(struct gw_info * gw, struct gw_info * gws) {
-	int tmp = 0, gw_index = 0;
+	int tmp = 0, gw_index = 0, i;
 
-	for (int i = 1; i <= gws[0].ip_addr.u.addr32[0]; i++) {
+	for (i = 1; i <= gws[0].ip_addr.u.addr32[0]; i++) {
 		tmp = memcmp(gws[i].ip_addr.u.addr, gw->ip_addr.u.addr, gws[i].ip_addr.len);
 		if (gws[i].ip_addr.af == gw->ip_addr.af &&
 			gws[i].ip_addr.len == gw->ip_addr.len &&




More information about the sr-dev mailing list