[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:
Willy Tarreau 2007-06-10 11:17:01 +02:00
parent d41f8d85e8
commit bb76891d0f
2 changed files with 3 additions and 0 deletions

View File

@ -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 */
};

View File

@ -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;
}