action_render_string_filters_template(): Declare a variable at the beginning
authorFabian Keil <fk@fabiankeil.de>
Sat, 19 Dec 2020 15:59:48 +0000 (16:59 +0100)
committerFabian Keil <fk@fabiankeil.de>
Sun, 20 Dec 2020 09:59:39 +0000 (10:59 +0100)
... of the function to silence a compiler warning when building with -std=c89:

   cc -c -pipe -fstack-protector-all -ggdb -Wshadow  -Wconversion -I/usr/local/include/  -pthread -Wall -std=c89   cgiedit.c -o cgiedit.o
   cgiedit.c:4436:9: warning: GCC does not allow variable declarations in for loop initializers before C99 [-Wgcc-compat]
      for (int i=0; i < SZ(desc); ++i)
           ^
   1 warning generated.

cgiedit.c

index af22d07..e979ebc 100644 (file)
--- a/cgiedit.c
+++ b/cgiedit.c
@@ -4421,6 +4421,7 @@ static jb_err action_render_string_filters_template(struct map * exports,
 {
    jb_err err = JB_ERR_OK;
    int filter_identifier = 0;
 {
    jb_err err = JB_ERR_OK;
    int filter_identifier = 0;
+   int i;
    char *prepared_template = strdup("");
 
    struct action_multi {
    char *prepared_template = strdup("");
 
    struct action_multi {
@@ -4433,7 +4434,7 @@ static jb_err action_render_string_filters_template(struct map * exports,
        { 'n', action->multi_remove[type->multi_action_index][0].first }
    };
 
        { 'n', action->multi_remove[type->multi_action_index][0].first }
    };
 
-   for (int i=0; i < SZ(desc); ++i)
+   for (i = 0; i < SZ(desc); ++i)
    {
       const char radio = desc[i].radio;
       struct list_entry *entry = desc[i].list;
    {
       const char radio = desc[i].radio;
       struct list_entry *entry = desc[i].list;