hlua_init() uses 'idx' only in openssl related code, while 'i' is used
in shared code and is safe to be reused. This commit replaces the use of
'idx' with 'i'

  $ make V=1 TARGET=linux-glibc USE_LUA=1 USE_OPENSSL=
  ..
  cc -Iinclude  -O2 -g -Wall -Wextra -Wdeclaration-after-statement -fwrapv 
-Wno-address-of-packed-member -Wno-unused-label -Wno-sign-compare 
-Wno-unused-parameter -Wno-clobbered -Wno-missing-field-initializers 
-Wno-cast-function-type  -Wtype-limits -Wshift-negative-value 
-Wshift-overflow=2 -Wduplicated-cond -Wnull-dereference   -DUSE_EPOLL  
-DUSE_NETFILTER     -DUSE_POLL  -DUSE_THREAD  -DUSE_BACKTRACE   -DUSE_TPROXY 
-DUSE_LINUX_TPROXY -DUSE_LINUX_SPLICE -DUSE_LIBCRYPT -DUSE_CRYPT_H 
-DUSE_GETADDRINFO  -DUSE_LUA -DUSE_FUTEX -DUSE_ACCEPT4    -DUSE_CPU_AFFINITY 
-DUSE_TFO -DUSE_NS -DUSE_DL -DUSE_RT      -DUSE_PRCTL -DUSE_THREAD_DUMP    
-I/usr/include/lua5.3 -I/usr/include/lua5.3  
-DCONFIG_HAPROXY_VERSION=\"2.4-dev5-37286a-78\" 
-DCONFIG_HAPROXY_DATE=\"2021/01/21\" -c -o src/hlua.o src/hlua.c
  src/hlua.c: In function 'hlua_init':
  src/hlua.c:9145:6: warning: unused variable 'idx' [-Wunused-variable]
   9145 |  int idx;
        |      ^~~
---
 src/hlua.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/hlua.c b/src/hlua.c
index 1893511f4a59..785a1fa3686e 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -9142,7 +9142,6 @@ lua_State *hlua_init_state(int thread_num)
 
 void hlua_init(void) {
        int i;
-       int idx;
 #ifdef USE_OPENSSL
        struct srv_kw *kw;
        int tmp_error;
@@ -9273,8 +9272,8 @@ void hlua_init(void) {
        socket_ssl.use_ssl = 1;
        socket_ssl.xprt = xprt_get(XPRT_SSL);
 
-       for (idx = 0; args[idx] != NULL; idx++) {
-               if ((kw = srv_find_kw(args[idx])) != NULL) { /* Maybe it's 
registered server keyword */
+       for (i = 0; args[i] != NULL; i++) {
+               if ((kw = srv_find_kw(args[i])) != NULL) { /* Maybe it's 
registered server keyword */
                        /*
                         *
                         * If the keyword is not known, we can search in the 
registered
@@ -9282,13 +9281,13 @@ void hlua_init(void) {
                         * features like client certificates and ssl_verify.
                         *
                         */
-                       tmp_error = kw->parse(args, &idx, &socket_proxy, 
&socket_ssl, &error);
+                       tmp_error = kw->parse(args, &i, &socket_proxy, 
&socket_ssl, &error);
                        if (tmp_error != 0) {
                                fprintf(stderr, "INTERNAL ERROR: %s\n", error);
                                abort(); /* This must be never arrives because 
the command line
                                            not editable by the user. */
                        }
-                       idx += kw->skip;
+                       i += kw->skip;
                }
        }
 #endif

Reply via email to