]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: stick-table: fix build errors introduced by last stick-table change
authorWilly Tarreau <w@1wt.eu>
Wed, 22 Jan 2020 16:09:47 +0000 (17:09 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 22 Jan 2020 16:11:00 +0000 (17:11 +0100)
Last commit 1a693fc2fd ("MEDIUM: cli: Allow multiple filter entries for "show table"")
broke the build at two places:

  src/stick_table.c: In function 'table_prepare_data_request':
  src/stick_table.c:3620:33: warning: ordered comparison of pointer with integer zero [-Wextra]
  src/stick_table.c: In function 'cli_io_handler_table':
  src/stick_table.c:3763:5: error: 'for' loop initial declarations are only allowed in C99 mode
  src/stick_table.c:3763:5: note: use option -std=c99 or -std=gnu99 to compile your code
  make: *** [src/stick_table.o] Error 1

This patch fixes both. No backport needed.

src/stick_table.c

index 1393b1ff362a5a76a1e0e48dc8fc6645b2d70027..e4eca989cb122fa8802435c4662c0a2c2a6f89b0 100644 (file)
@@ -3617,7 +3617,7 @@ static int table_prepare_data_request(struct appctx *appctx, char **args)
                        return cli_err(appctx, "Data type not stored in this table\n");
 
                appctx->ctx.table.data_op[i] = get_std_op(args[4+3*i]);
-               if (appctx->ctx.table.data_op < 0)
+               if (appctx->ctx.table.data_op[i] < 0)
                        return cli_err(appctx, "Require and operator among \"eq\", \"ne\", \"le\", \"ge\", \"lt\", \"gt\"\n");
 
                if (!*args[5] || strl2llrc(args[5+3*i], strlen(args[5+3*i]), &appctx->ctx.table.value[i]) != 0)
@@ -3755,12 +3755,12 @@ static int cli_io_handler_table(struct appctx *appctx)
                        if (appctx->ctx.table.data_type[0] >= 0) {
                                /* we're filtering on some data contents */
                                void *ptr;
-                               int dt;
+                               int dt, i;
                                signed char op;
                                long long data, value;
 
 
-                               for (int i = 0; i < STKTABLE_FILTER_LEN; i++) {
+                               for (i = 0; i < STKTABLE_FILTER_LEN; i++) {
                                        if (appctx->ctx.table.data_type[i] == -1)
                                                break;
                                        dt = appctx->ctx.table.data_type[i];