From f14c7570d6da32f0908c719caa3a19c07652df21 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sat, 13 Mar 2021 10:59:23 +0100 Subject: [PATCH] CLEANUP: cli: rename MAX_STATS_ARGS to MAX_CLI_ARGS This is the number of args accepted on a command received on the CLI, is has long been totally independent of stats and should not carry this misleading "stats" name anymore. --- include/haproxy/defaults.h | 4 ++-- src/cli.c | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/haproxy/defaults.h b/include/haproxy/defaults.h index 3dc98e5ce..f6a15db71 100644 --- a/include/haproxy/defaults.h +++ b/include/haproxy/defaults.h @@ -110,9 +110,9 @@ // max # args on crt-bind-list configuration line #define MAX_CRT_ARGS 2048 -// max # args on a stats socket +// max # args on a command issued on the CLI ("stats socket") // This should cover at least 5 + twice the # of data_types -#define MAX_STATS_ARGS 64 +#define MAX_CLI_ARGS 64 // max # of matches per regexp #define MAX_MATCH 10 diff --git a/src/cli.c b/src/cli.c index 6791ff2ae..6859ad6b6 100644 --- a/src/cli.c +++ b/src/cli.c @@ -628,7 +628,7 @@ static int cli_get_severity_output(struct appctx *appctx) */ static int cli_parse_request(struct appctx *appctx) { - char *args[MAX_STATS_ARGS + 1], *p, *end, *payload = NULL; + char *args[MAX_CLI_ARGS + 1], *p, *end, *payload = NULL; int i = 0; struct cli_kw *kw; @@ -658,7 +658,7 @@ static int cli_parse_request(struct appctx *appctx) * Get pointers on words. * One extra slot is reserved to store a pointer on a null byte. */ - while (i < MAX_STATS_ARGS && p < end) { + while (i < MAX_CLI_ARGS && p < end) { int j, k; /* skip leading spaces/tabs */ @@ -698,7 +698,7 @@ static int cli_parse_request(struct appctx *appctx) } /* fill unused slots */ p = appctx->chunk->area + appctx->chunk->data; - for (; i < MAX_STATS_ARGS + 1; i++) + for (; i < MAX_CLI_ARGS + 1; i++) args[i] = p; kw = cli_find_kw(args); @@ -2182,7 +2182,7 @@ int pcli_parse_request(struct stream *s, struct channel *req, char **errmsg, int { char *str = (char *)ci_head(req); char *end = (char *)ci_stop(req); - char *args[MAX_STATS_ARGS + 1]; /* +1 for storing a NULL */ + char *args[MAX_CLI_ARGS + 1]; /* +1 for storing a NULL */ int argl; /* number of args */ char *p; char *trim = NULL; @@ -2239,7 +2239,7 @@ int pcli_parse_request(struct stream *s, struct channel *req, char **errmsg, int *(end-1) = '\0'; /* splits the command in words */ - while (i < MAX_STATS_ARGS && p < end) { + while (i < MAX_CLI_ARGS && p < end) { /* skip leading spaces/tabs */ p += strspn(p, " \t"); if (!*p) @@ -2264,7 +2264,7 @@ int pcli_parse_request(struct stream *s, struct channel *req, char **errmsg, int argl = i; - for (; i < MAX_STATS_ARGS + 1; i++) + for (; i < MAX_CLI_ARGS + 1; i++) args[i] = NULL; wtrim = pcli_find_and_exec_kw(s, args, argl, errmsg, next_pid);