[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 d679288..0eecd33 100644
--- a/include/types/acl.h
+++ b/include/types/acl.h
@@ -164,6 +164,7 @@
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 4443ae9..2cd154c 100644
--- a/src/acl.c
+++ b/src/acl.c
@@ -435,6 +435,7 @@
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 @@
goto out_free_expr;
memcpy(arg2, arg, end - arg);
arg2[end-arg] = '\0';
+ expr->arg_len = end - arg;
expr->arg.str = arg2;
}