]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: stats: move a misplaced stats context initialization
authorWilly Tarreau <w@1wt.eu>
Fri, 16 Dec 2016 11:33:47 +0000 (12:33 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 16 Dec 2016 18:40:13 +0000 (19:40 +0100)
This is a leftover from the cleanup campaign, the stats scope was still
initialized by the CLI instead of being initialized by the stats keyword
parsers. This should probably be backported to 1.7 to make the code more
consistent.

src/cli.c
src/stats.c

index 12556bc1160c680876467826f3d82b76e176fc7c..82c1bf7595ae382c2b1c31b71972d8746dc1cc88 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -454,9 +454,6 @@ static int cli_parse_request(struct appctx *appctx, char *line)
                arg++;
        }
 
-       appctx->ctx.stats.scope_str = 0;
-       appctx->ctx.stats.scope_len = 0;
-       appctx->ctx.stats.flags = 0;
        appctx->st2 = 0;
 
        kw = cli_find_kw(args);
index 8ad983df6c17a12a9e49bf63124f1c6364db452b..976496e2819863d821f99be4840a0488a2609094 100644 (file)
@@ -3096,6 +3096,10 @@ static int cli_parse_clear_counters(char **args, struct appctx *appctx, void *pr
 
 static int cli_parse_show_info(char **args, struct appctx *appctx, void *private)
 {
+       appctx->ctx.stats.scope_str = 0;
+       appctx->ctx.stats.scope_len = 0;
+       appctx->ctx.stats.flags = 0;
+
        if (strcmp(args[2], "typed") == 0)
                appctx->ctx.stats.flags |= STAT_FMT_TYPED;
        return 0;
@@ -3104,6 +3108,10 @@ static int cli_parse_show_info(char **args, struct appctx *appctx, void *private
 
 static int cli_parse_show_stat(char **args, struct appctx *appctx, void *private)
 {
+       appctx->ctx.stats.scope_str = 0;
+       appctx->ctx.stats.scope_len = 0;
+       appctx->ctx.stats.flags = 0;
+
        if (*args[2] && *args[3] && *args[4]) {
                struct proxy *px;