From: Willy Tarreau Date: Sun, 10 Jun 2007 09:17:01 +0000 (+0200) Subject: [MINOR] acl: provide the argument length for fetch functions X-Git-Tag: v1.3.12~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb76891d0ffa5f81a86e426f3e2680132a4ff971;p=thirdparty%2Fhaproxy.git [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. --- diff --git a/include/types/acl.h b/include/types/acl.h index d679288975..0eecd335f0 100644 --- a/include/types/acl.h +++ b/include/types/acl.h @@ -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 */ }; diff --git a/src/acl.c b/src/acl.c index 4443ae9ade..2cd154ca0d 100644 --- a/src/acl.c +++ b/src/acl.c @@ -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; }