mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-28 14:21:00 +01:00
[MINOR] acl: provide the argument length for fetch functions
Some fetch() functions will require an argument (eg: header). It's wise to provide the argument size to optimize string comparisons.
This commit is contained in:
parent
d41f8d85e8
commit
bb76891d0f
@ -164,6 +164,7 @@ struct acl_expr {
|
||||
union { /* optional argument of the subject (eg: header or cookie name) */
|
||||
char *str;
|
||||
} arg;
|
||||
int arg_len; /* optional argument length */
|
||||
struct list patterns; /* list of acl_patterns */
|
||||
};
|
||||
|
||||
|
||||
@ -435,6 +435,7 @@ struct acl_expr *parse_acl_expr(const char **args)
|
||||
aclkw->use_cnt++;
|
||||
LIST_INIT(&expr->patterns);
|
||||
expr->arg.str = NULL;
|
||||
expr->arg_len = 0;
|
||||
|
||||
arg = strchr(args[0], '(');
|
||||
if (arg != NULL) {
|
||||
@ -449,6 +450,7 @@ struct acl_expr *parse_acl_expr(const char **args)
|
||||
goto out_free_expr;
|
||||
memcpy(arg2, arg, end - arg);
|
||||
arg2[end-arg] = '\0';
|
||||
expr->arg_len = end - arg;
|
||||
expr->arg.str = arg2;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user