mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-07 17:51:45 +00:00
CLEANUP: log-format: remove unused arguments
The log-format function parse_logformat_string() takes file and line for building parsing logs. These two parameters are embedded in the struct proxy curproxy, which is the current parsing context. This patch removes these two unused arguments.
This commit is contained in:
parent
bca46f0d9d
commit
6fe0e1b977
@ -74,7 +74,7 @@ void add_to_logformat_list(char *start, char *end, int type, struct list *list_f
|
||||
* Variable name are preceded by % and composed by characters [a-zA-Z0-9]* : %varname
|
||||
* You can set arguments using { } : %{many arguments}varname
|
||||
*/
|
||||
void parse_logformat_string(const char *str, struct proxy *curproxy, struct list *list_format, int options, int cap, const char *file, int line);
|
||||
void parse_logformat_string(const char *str, struct proxy *curproxy, struct list *list_format, int options, int cap);
|
||||
/*
|
||||
* Displays the message on stderr with the date and pid. Overrides the quiet
|
||||
* mode during startup.
|
||||
|
@ -7788,8 +7788,7 @@ int check_config_validity()
|
||||
*/
|
||||
pxname = rule->be.name;
|
||||
LIST_INIT(&rule->be.expr);
|
||||
parse_logformat_string(pxname, curproxy, &rule->be.expr, 0, SMP_VAL_FE_HRQ_HDR,
|
||||
curproxy->conf.args.file, curproxy->conf.args.line);
|
||||
parse_logformat_string(pxname, curproxy, &rule->be.expr, 0, SMP_VAL_FE_HRQ_HDR);
|
||||
node = LIST_NEXT(&rule->be.expr, struct logformat_node *, list);
|
||||
|
||||
if (!LIST_ISEMPTY(&rule->be.expr)) {
|
||||
@ -8274,7 +8273,7 @@ out_uri_auth_compat:
|
||||
curproxy->conf.args.file = curproxy->conf.lfs_file;
|
||||
curproxy->conf.args.line = curproxy->conf.lfs_line;
|
||||
parse_logformat_string(curproxy->conf.logformat_string, curproxy, &curproxy->logformat, LOG_OPT_MANDATORY,
|
||||
SMP_VAL_FE_LOG_END, curproxy->conf.lfs_file, curproxy->conf.lfs_line);
|
||||
SMP_VAL_FE_LOG_END);
|
||||
curproxy->conf.args.file = NULL;
|
||||
curproxy->conf.args.line = 0;
|
||||
}
|
||||
@ -8284,7 +8283,7 @@ out_uri_auth_compat:
|
||||
curproxy->conf.args.file = curproxy->conf.lfsd_file;
|
||||
curproxy->conf.args.line = curproxy->conf.lfsd_line;
|
||||
parse_logformat_string(curproxy->conf.logformat_sd_string, curproxy, &curproxy->logformat_sd, LOG_OPT_MANDATORY,
|
||||
SMP_VAL_FE_LOG_END, curproxy->conf.lfsd_file, curproxy->conf.lfsd_line);
|
||||
SMP_VAL_FE_LOG_END);
|
||||
add_to_logformat_list(NULL, NULL, LF_SEPARATOR, &curproxy->logformat_sd);
|
||||
curproxy->conf.args.file = NULL;
|
||||
curproxy->conf.args.line = 0;
|
||||
@ -8295,8 +8294,7 @@ out_uri_auth_compat:
|
||||
curproxy->conf.args.file = curproxy->conf.uif_file;
|
||||
curproxy->conf.args.line = curproxy->conf.uif_line;
|
||||
parse_logformat_string(curproxy->conf.uniqueid_format_string, curproxy, &curproxy->format_unique_id, LOG_OPT_HTTP,
|
||||
(curproxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR,
|
||||
curproxy->conf.uif_file, curproxy->conf.uif_line);
|
||||
(curproxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR);
|
||||
curproxy->conf.args.file = NULL;
|
||||
curproxy->conf.args.line = 0;
|
||||
}
|
||||
|
@ -509,7 +509,7 @@ void add_sample_to_logformat_list(char *text, char *arg, int arg_len, struct pro
|
||||
* options: LOG_OPT_* to force on every node
|
||||
* cap: all SMP_VAL_* flags supported by the consumer
|
||||
*/
|
||||
void parse_logformat_string(const char *fmt, struct proxy *curproxy, struct list *list_format, int options, int cap, const char *file, int line)
|
||||
void parse_logformat_string(const char *fmt, struct proxy *curproxy, struct list *list_format, int options, int cap)
|
||||
{
|
||||
char *sp, *str, *backfmt; /* start pointer for text parts */
|
||||
char *arg = NULL; /* start pointer for args */
|
||||
@ -632,7 +632,8 @@ void parse_logformat_string(const char *fmt, struct proxy *curproxy, struct list
|
||||
parse_logformat_var(arg, arg_len, var, var_len, curproxy, list_format, &options);
|
||||
break;
|
||||
case LF_STEXPR:
|
||||
add_sample_to_logformat_list(var, arg, arg_len, curproxy, list_format, options, cap, file, line);
|
||||
add_sample_to_logformat_list(var, arg, arg_len, curproxy, list_format, options, cap,
|
||||
curproxy->conf.args.file, curproxy->conf.args.line);
|
||||
break;
|
||||
case LF_TEXT:
|
||||
case LF_SEPARATOR:
|
||||
|
@ -9140,8 +9140,7 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
|
||||
|
||||
proxy->conf.args.ctx = ARGC_HRQ;
|
||||
parse_logformat_string(args[cur_arg + 1], proxy, &rule->arg.hdr_add.fmt, LOG_OPT_HTTP,
|
||||
(proxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR,
|
||||
file, linenum);
|
||||
(proxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR);
|
||||
free(proxy->conf.lfs_file);
|
||||
proxy->conf.lfs_file = strdup(proxy->conf.args.file);
|
||||
proxy->conf.lfs_line = proxy->conf.args.line;
|
||||
@ -9171,8 +9170,7 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
|
||||
|
||||
proxy->conf.args.ctx = ARGC_HRQ;
|
||||
parse_logformat_string(args[cur_arg + 2], proxy, &rule->arg.hdr_add.fmt, LOG_OPT_HTTP,
|
||||
(proxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR,
|
||||
file, linenum);
|
||||
(proxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR);
|
||||
|
||||
free(proxy->conf.lfs_file);
|
||||
proxy->conf.lfs_file = strdup(proxy->conf.args.file);
|
||||
@ -9284,8 +9282,7 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
|
||||
LIST_INIT(&rule->arg.map.key);
|
||||
proxy->conf.args.ctx = ARGC_HRQ;
|
||||
parse_logformat_string(args[cur_arg], proxy, &rule->arg.map.key, LOG_OPT_HTTP,
|
||||
(proxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR,
|
||||
file, linenum);
|
||||
(proxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR);
|
||||
free(proxy->conf.lfs_file);
|
||||
proxy->conf.lfs_file = strdup(proxy->conf.args.file);
|
||||
proxy->conf.lfs_line = proxy->conf.args.line;
|
||||
@ -9311,8 +9308,7 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
|
||||
LIST_INIT(&rule->arg.map.key);
|
||||
proxy->conf.args.ctx = ARGC_HRQ;
|
||||
parse_logformat_string(args[cur_arg], proxy, &rule->arg.map.key, LOG_OPT_HTTP,
|
||||
(proxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR,
|
||||
file, linenum);
|
||||
(proxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR);
|
||||
free(proxy->conf.lfs_file);
|
||||
proxy->conf.lfs_file = strdup(proxy->conf.args.file);
|
||||
proxy->conf.lfs_line = proxy->conf.args.line;
|
||||
@ -9338,8 +9334,7 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
|
||||
LIST_INIT(&rule->arg.map.key);
|
||||
proxy->conf.args.ctx = ARGC_HRQ;
|
||||
parse_logformat_string(args[cur_arg], proxy, &rule->arg.map.key, LOG_OPT_HTTP,
|
||||
(proxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR,
|
||||
file, linenum);
|
||||
(proxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR);
|
||||
free(proxy->conf.lfs_file);
|
||||
proxy->conf.lfs_file = strdup(proxy->conf.args.file);
|
||||
proxy->conf.lfs_line = proxy->conf.args.line;
|
||||
@ -9368,13 +9363,11 @@ struct act_rule *parse_http_req_cond(const char **args, const char *file, int li
|
||||
|
||||
/* key pattern */
|
||||
parse_logformat_string(args[cur_arg], proxy, &rule->arg.map.key, LOG_OPT_HTTP,
|
||||
(proxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR,
|
||||
file, linenum);
|
||||
(proxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR);
|
||||
|
||||
/* value pattern */
|
||||
parse_logformat_string(args[cur_arg + 1], proxy, &rule->arg.map.value, LOG_OPT_HTTP,
|
||||
(proxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR,
|
||||
file, linenum);
|
||||
(proxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR);
|
||||
free(proxy->conf.lfs_file);
|
||||
proxy->conf.lfs_file = strdup(proxy->conf.args.file);
|
||||
proxy->conf.lfs_line = proxy->conf.args.line;
|
||||
@ -9545,8 +9538,7 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
|
||||
|
||||
proxy->conf.args.ctx = ARGC_HRS;
|
||||
parse_logformat_string(args[cur_arg + 1], proxy, &rule->arg.hdr_add.fmt, LOG_OPT_HTTP,
|
||||
(proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR,
|
||||
file, linenum);
|
||||
(proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR);
|
||||
free(proxy->conf.lfs_file);
|
||||
proxy->conf.lfs_file = strdup(proxy->conf.args.file);
|
||||
proxy->conf.lfs_line = proxy->conf.args.line;
|
||||
@ -9576,8 +9568,7 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
|
||||
|
||||
proxy->conf.args.ctx = ARGC_HRQ;
|
||||
parse_logformat_string(args[cur_arg + 2], proxy, &rule->arg.hdr_add.fmt, LOG_OPT_HTTP,
|
||||
(proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR,
|
||||
file, linenum);
|
||||
(proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR);
|
||||
|
||||
free(proxy->conf.lfs_file);
|
||||
proxy->conf.lfs_file = strdup(proxy->conf.args.file);
|
||||
@ -9623,8 +9614,7 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
|
||||
LIST_INIT(&rule->arg.map.key);
|
||||
proxy->conf.args.ctx = ARGC_HRS;
|
||||
parse_logformat_string(args[cur_arg], proxy, &rule->arg.map.key, LOG_OPT_HTTP,
|
||||
(proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR,
|
||||
file, linenum);
|
||||
(proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR);
|
||||
free(proxy->conf.lfs_file);
|
||||
proxy->conf.lfs_file = strdup(proxy->conf.args.file);
|
||||
proxy->conf.lfs_line = proxy->conf.args.line;
|
||||
@ -9651,8 +9641,7 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
|
||||
LIST_INIT(&rule->arg.map.key);
|
||||
proxy->conf.args.ctx = ARGC_HRS;
|
||||
parse_logformat_string(args[cur_arg], proxy, &rule->arg.map.key, LOG_OPT_HTTP,
|
||||
(proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR,
|
||||
file, linenum);
|
||||
(proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR);
|
||||
free(proxy->conf.lfs_file);
|
||||
proxy->conf.lfs_file = strdup(proxy->conf.args.file);
|
||||
proxy->conf.lfs_line = proxy->conf.args.line;
|
||||
@ -9678,8 +9667,7 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
|
||||
LIST_INIT(&rule->arg.map.key);
|
||||
proxy->conf.args.ctx = ARGC_HRS;
|
||||
parse_logformat_string(args[cur_arg], proxy, &rule->arg.map.key, LOG_OPT_HTTP,
|
||||
(proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR,
|
||||
file, linenum);
|
||||
(proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR);
|
||||
free(proxy->conf.lfs_file);
|
||||
proxy->conf.lfs_file = strdup(proxy->conf.args.file);
|
||||
proxy->conf.lfs_line = proxy->conf.args.line;
|
||||
@ -9709,13 +9697,11 @@ struct act_rule *parse_http_res_cond(const char **args, const char *file, int li
|
||||
|
||||
/* key pattern */
|
||||
parse_logformat_string(args[cur_arg], proxy, &rule->arg.map.key, LOG_OPT_HTTP,
|
||||
(proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR,
|
||||
file, linenum);
|
||||
(proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR);
|
||||
|
||||
/* value pattern */
|
||||
parse_logformat_string(args[cur_arg + 1], proxy, &rule->arg.map.value, LOG_OPT_HTTP,
|
||||
(proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR,
|
||||
file, linenum);
|
||||
(proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR);
|
||||
|
||||
free(proxy->conf.lfs_file);
|
||||
proxy->conf.lfs_file = strdup(proxy->conf.args.file);
|
||||
@ -9961,8 +9947,7 @@ struct redirect_rule *http_parse_redirect_rule(const char *file, int linenum, st
|
||||
if (!(type == REDIRECT_TYPE_PREFIX && destination[0] == '/' && destination[1] == '\0')) {
|
||||
parse_logformat_string(destination, curproxy, &rule->rdr_fmt, LOG_OPT_HTTP,
|
||||
dir ? (curproxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRS_HDR : SMP_VAL_BE_HRS_HDR
|
||||
: (curproxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR,
|
||||
file, linenum);
|
||||
: (curproxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR);
|
||||
free(curproxy->conf.lfs_file);
|
||||
curproxy->conf.lfs_file = strdup(curproxy->conf.args.file);
|
||||
curproxy->conf.lfs_line = curproxy->conf.args.line;
|
||||
@ -12456,8 +12441,7 @@ enum act_parse_ret parse_set_req_line(const char **args, int *orig_arg, struct p
|
||||
LIST_INIT(&rule->arg.http.logfmt);
|
||||
proxy->conf.args.ctx = ARGC_HRQ;
|
||||
parse_logformat_string(args[cur_arg], proxy, &rule->arg.http.logfmt, LOG_OPT_HTTP,
|
||||
(proxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR,
|
||||
proxy->conf.args.file, proxy->conf.args.line);
|
||||
(proxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR);
|
||||
|
||||
(*orig_arg)++;
|
||||
return ACT_RET_PRS_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user