MEDIUM: pattern/acl: get rid of temp_pattern in ACLs

This one is not needed anymore as we can return the data and its type in the
sample provided by the caller. ACLs now always return the proper type. BOOL
is already returned when the result is expected to be processed as a boolean.

temp_pattern has been unexported now.
diff --git a/src/acl.c b/src/acl.c
index b7251ce..91a9754 100644
--- a/src/acl.c
+++ b/src/acl.c
@@ -68,6 +68,7 @@
 acl_fetch_true(struct proxy *px, struct session *l4, void *l7, int dir,
                struct acl_expr *expr, struct sample *smp)
 {
+	smp->type = SMP_T_BOOL;
 	smp->flags |= SMP_F_SET_RES_PASS;
 	return 1;
 }
@@ -83,6 +84,7 @@
 		smp->flags |= SMP_F_MAY_CHANGE;
 		return 0;
 	}
+	smp->type = SMP_T_BOOL;
 	smp->flags |= SMP_F_SET_RES_PASS;
 	return 1;
 }
@@ -92,6 +94,7 @@
 acl_fetch_false(struct proxy *px, struct session *l4, void *l7, int dir,
                 struct acl_expr *expr, struct sample *smp)
 {
+	smp->type = SMP_T_BOOL;
 	smp->flags |= SMP_F_SET_RES_FAIL;
 	return 1;
 }
@@ -104,7 +107,8 @@
 	if (!l4 || !l4->req)
 		return 0;
 
-	temp_pattern.data.uint = l4->req->i;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = l4->req->i;
 	smp->flags = SMP_F_VOLATILE | SMP_F_MAY_CHANGE;
 	return 1;
 }
@@ -157,7 +161,8 @@
 		goto not_ssl_hello;
 	}
 
-	temp_pattern.data.uint = hs_type;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = hs_type;
 	smp->flags = SMP_F_VOLATILE;
 
 	return 1;
@@ -270,7 +275,8 @@
 	/* OK that's enough. We have at least the whole message, and we have
 	 * the protocol version.
 	 */
-	temp_pattern.data.uint = version;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = version;
 	smp->flags = SMP_F_VOLATILE;
 	return 1;
 
@@ -425,8 +431,9 @@
 			name_len = (data[7] << 8) + data[8];
 
 			if (name_type == 0) { /* hostname */
-				temp_pattern.data.str.str = (char *)data + 9;
-				temp_pattern.data.str.len = name_len;
+				smp->type = SMP_T_CSTR;
+				smp->data.str.str = (char *)data + 9;
+				smp->data.str.len = name_len;
 				smp->flags = SMP_F_VOLATILE;
 				return 1;
 			}
@@ -462,6 +469,7 @@
 		return 0;
 
 	smp->flags = 0;
+	smp->type = SMP_T_CSTR;
 
 	bleft = l4->req->i;
 	if (bleft <= 11)
@@ -514,8 +522,8 @@
 	}
 
 	/* data points to cookie value */
-	temp_pattern.data.str.str = (char *)data;
-	temp_pattern.data.str.len = 0;
+	smp->data.str.str = (char *)data;
+	smp->data.str.len = 0;
 
 	while (bleft > 0 && *data != '\r') {
 		data++;
@@ -528,7 +536,7 @@
 	if (data[0] != '\r' || data[1] != '\n')
 		goto not_cookie;
 
-	temp_pattern.data.str.len = (char *)data - temp_pattern.data.str.str;
+	smp->data.str.len = (char *)data - smp->data.str.str;
 	smp->flags = SMP_F_VOLATILE;
 	return 1;
 
@@ -546,14 +554,12 @@
 
 	ret = acl_fetch_rdp_cookie(px, l4, l7, dir, expr, smp);
 
-	temp_pattern.data.str.str = NULL;
-	temp_pattern.data.str.len = 0;
-
 	if (smp->flags & SMP_F_MAY_CHANGE)
 		return 0;
 
 	smp->flags = SMP_F_VOLATILE;
-	temp_pattern.data.uint = ret;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = ret;
 
 	return 1;
 }
@@ -588,12 +594,12 @@
 {
 	int icase;
 
-	if (pattern->len != temp_pattern.data.str.len)
+	if (pattern->len != smp->data.str.len)
 		return ACL_PAT_FAIL;
 
 	icase = pattern->flags & ACL_PAT_F_IGNORE_CASE;
-	if ((icase && strncasecmp(pattern->ptr.str, temp_pattern.data.str.str, temp_pattern.data.str.len) == 0) ||
-	    (!icase && strncmp(pattern->ptr.str, temp_pattern.data.str.str, temp_pattern.data.str.len) == 0))
+	if ((icase && strncasecmp(pattern->ptr.str, smp->data.str.str, smp->data.str.len) == 0) ||
+	    (!icase && strncmp(pattern->ptr.str, smp->data.str.str, smp->data.str.len) == 0))
 		return ACL_PAT_PASS;
 	return ACL_PAT_FAIL;
 }
@@ -608,12 +614,12 @@
 	char prev;
 
 	/* we may have to force a trailing zero on the test pattern */
-	prev = temp_pattern.data.str.str[temp_pattern.data.str.len];
+	prev = smp->data.str.str[smp->data.str.len];
 	if (prev)
-		temp_pattern.data.str.str[temp_pattern.data.str.len] = '\0';
-	node = ebst_lookup(&expr->pattern_tree, temp_pattern.data.str.str);
+		smp->data.str.str[smp->data.str.len] = '\0';
+	node = ebst_lookup(&expr->pattern_tree, smp->data.str.str);
 	if (prev)
-		temp_pattern.data.str.str[temp_pattern.data.str.len] = prev;
+		smp->data.str.str[smp->data.str.len] = prev;
 	return node;
 }
 
@@ -630,28 +636,28 @@
 	if (unlikely(smp->flags & SMP_F_READ_ONLY)) {
 		char *new_str;
 
-		new_str = calloc(1, temp_pattern.data.str.len + 1);
+		new_str = calloc(1, smp->data.str.len + 1);
 		if (!new_str)
 			return ACL_PAT_FAIL;
 
-		memcpy(new_str, temp_pattern.data.str.str, temp_pattern.data.str.len);
-		new_str[temp_pattern.data.str.len] = 0;
+		memcpy(new_str, smp->data.str.str, smp->data.str.len);
+		new_str[smp->data.str.len] = 0;
 		if (smp->flags & SMP_F_MUST_FREE)
-			free(temp_pattern.data.str.str);
-		temp_pattern.data.str.str = new_str;
+			free(smp->data.str.str);
+		smp->data.str.str = new_str;
 		smp->flags |= SMP_F_MUST_FREE;
 		smp->flags &= ~SMP_F_READ_ONLY;
 	}
 
-	old_char = temp_pattern.data.str.str[temp_pattern.data.str.len];
-	temp_pattern.data.str.str[temp_pattern.data.str.len] = 0;
+	old_char = smp->data.str.str[smp->data.str.len];
+	smp->data.str.str[smp->data.str.len] = 0;
 
-	if (regexec(pattern->ptr.reg, temp_pattern.data.str.str, 0, NULL, 0) == 0)
+	if (regexec(pattern->ptr.reg, smp->data.str.str, 0, NULL, 0) == 0)
 		ret = ACL_PAT_PASS;
 	else
 		ret = ACL_PAT_FAIL;
 
-	temp_pattern.data.str.str[temp_pattern.data.str.len] = old_char;
+	smp->data.str.str[smp->data.str.len] = old_char;
 	return ret;
 }
 
@@ -660,12 +666,12 @@
 {
 	int icase;
 
-	if (pattern->len > temp_pattern.data.str.len)
+	if (pattern->len > smp->data.str.len)
 		return ACL_PAT_FAIL;
 
 	icase = pattern->flags & ACL_PAT_F_IGNORE_CASE;
-	if ((icase && strncasecmp(pattern->ptr.str, temp_pattern.data.str.str, pattern->len) != 0) ||
-	    (!icase && strncmp(pattern->ptr.str, temp_pattern.data.str.str, pattern->len) != 0))
+	if ((icase && strncasecmp(pattern->ptr.str, smp->data.str.str, pattern->len) != 0) ||
+	    (!icase && strncmp(pattern->ptr.str, smp->data.str.str, pattern->len) != 0))
 		return ACL_PAT_FAIL;
 	return ACL_PAT_PASS;
 }
@@ -675,11 +681,11 @@
 {
 	int icase;
 
-	if (pattern->len > temp_pattern.data.str.len)
+	if (pattern->len > smp->data.str.len)
 		return ACL_PAT_FAIL;
 	icase = pattern->flags & ACL_PAT_F_IGNORE_CASE;
-	if ((icase && strncasecmp(pattern->ptr.str, temp_pattern.data.str.str + temp_pattern.data.str.len - pattern->len, pattern->len) != 0) ||
-	    (!icase && strncmp(pattern->ptr.str, temp_pattern.data.str.str + temp_pattern.data.str.len - pattern->len, pattern->len) != 0))
+	if ((icase && strncasecmp(pattern->ptr.str, smp->data.str.str + smp->data.str.len - pattern->len, pattern->len) != 0) ||
+	    (!icase && strncmp(pattern->ptr.str, smp->data.str.str + smp->data.str.len - pattern->len, pattern->len) != 0))
 		return ACL_PAT_FAIL;
 	return ACL_PAT_PASS;
 }
@@ -693,20 +699,20 @@
 	char *end;
 	char *c;
 
-	if (pattern->len > temp_pattern.data.str.len)
+	if (pattern->len > smp->data.str.len)
 		return ACL_PAT_FAIL;
 
-	end = temp_pattern.data.str.str + temp_pattern.data.str.len - pattern->len;
+	end = smp->data.str.str + smp->data.str.len - pattern->len;
 	icase = pattern->flags & ACL_PAT_F_IGNORE_CASE;
 	if (icase) {
-		for (c = temp_pattern.data.str.str; c <= end; c++) {
+		for (c = smp->data.str.str; c <= end; c++) {
 			if (tolower(*c) != tolower(*pattern->ptr.str))
 				continue;
 			if (strncasecmp(pattern->ptr.str, c, pattern->len) == 0)
 				return ACL_PAT_PASS;
 		}
 	} else {
-		for (c = temp_pattern.data.str.str; c <= end; c++) {
+		for (c = smp->data.str.str; c <= end; c++) {
 			if (*c != *pattern->ptr.str)
 				continue;
 			if (strncmp(pattern->ptr.str, c, pattern->len) == 0)
@@ -762,13 +768,13 @@
 	while (pl > 0 && is_delimiter(ps[pl - 1], delimiters))
 		pl--;
 
-	if (pl > temp_pattern.data.str.len)
+	if (pl > smp->data.str.len)
 		return ACL_PAT_FAIL;
 
 	may_match = 1;
 	icase = pattern->flags & ACL_PAT_F_IGNORE_CASE;
-	end = temp_pattern.data.str.str + temp_pattern.data.str.len - pl;
-	for (c = temp_pattern.data.str.str; c <= end; c++) {
+	end = smp->data.str.str + smp->data.str.len - pl;
+	for (c = smp->data.str.str; c <= end; c++) {
 		if (is_delimiter(*c, delimiters)) {
 			may_match = 1;
 			continue;
@@ -814,8 +820,8 @@
 /* Checks that the integer in <test> is included between min and max */
 int acl_match_int(struct sample *smp, struct acl_pattern *pattern)
 {
-	if ((!pattern->val.range.min_set || pattern->val.range.min <= temp_pattern.data.uint) &&
-	    (!pattern->val.range.max_set || temp_pattern.data.uint <= pattern->val.range.max))
+	if ((!pattern->val.range.min_set || pattern->val.range.min <= smp->data.uint) &&
+	    (!pattern->val.range.max_set || smp->data.uint <= pattern->val.range.max))
 		return ACL_PAT_PASS;
 	return ACL_PAT_FAIL;
 }
@@ -823,8 +829,8 @@
 /* Checks that the length of the pattern in <test> is included between min and max */
 int acl_match_len(struct sample *smp, struct acl_pattern *pattern)
 {
-	if ((!pattern->val.range.min_set || pattern->val.range.min <= temp_pattern.data.str.len) &&
-	    (!pattern->val.range.max_set || temp_pattern.data.str.len <= pattern->val.range.max))
+	if ((!pattern->val.range.min_set || pattern->val.range.min <= smp->data.str.len) &&
+	    (!pattern->val.range.max_set || smp->data.str.len <= pattern->val.range.max))
 		return ACL_PAT_PASS;
 	return ACL_PAT_FAIL;
 }
@@ -833,10 +839,10 @@
 {
 	struct in_addr *s;
 
-	if (temp_pattern.type != SMP_T_IPV4)
+	if (smp->type != SMP_T_IPV4)
 		return ACL_PAT_FAIL;
 
-	s = &temp_pattern.data.ipv4;
+	s = &smp->data.ipv4;
 	if (((s->s_addr ^ pattern->val.ipv4.addr.s_addr) & pattern->val.ipv4.mask.s_addr) == 0)
 		return ACL_PAT_PASS;
 	return ACL_PAT_FAIL;
@@ -849,10 +855,10 @@
 {
 	struct in_addr *s;
 
-	if (temp_pattern.type != SMP_T_IPV4)
+	if (smp->type != SMP_T_IPV4)
 		return ACL_PAT_FAIL;
 
-	s = &temp_pattern.data.ipv4;
+	s = &smp->data.ipv4;
 	return ebmb_lookup_longest(&expr->pattern_tree, &s->s_addr);
 }
 
@@ -1899,8 +1905,8 @@
 
 				/* now we may have some cleanup to do */
 				if (smp.flags & SMP_F_MUST_FREE) {
-					free(temp_pattern.data.str.str);
-					temp_pattern.data.str.len = 0;
+					free(smp.data.str.str);
+					smp.data.str.len = 0;
 				}
 
 				/* we're ORing these terms, so a single PASS is enough */
diff --git a/src/backend.c b/src/backend.c
index 36cf2c4..c60f3a3 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -421,7 +421,7 @@
 	expr.args = args;
 
 	ret = acl_fetch_rdp_cookie(px, s, NULL, ACL_DIR_REQ, &expr, &smp);
-	len = temp_pattern.data.str.len;
+	len = smp.data.str.len;
 
 	if (ret == 0 || (smp.flags & SMP_F_MAY_CHANGE) || len == 0)
 		return NULL;
@@ -433,7 +433,7 @@
 	/* Found a the hh_name in the headers.
 	 * we will compute the hash based on this value ctx.val.
 	 */
-	p = temp_pattern.data.str.str;
+	p = smp.data.str.str;
 	while (len) {
 		hash = *p + (hash << 6) + (hash << 16) - hash;
 		len--;
@@ -1143,14 +1143,14 @@
 	expr.args = args;
 
 	ret = acl_fetch_rdp_cookie(px, s, NULL, ACL_DIR_REQ, &expr, &smp);
-	if (ret == 0 || (smp.flags & SMP_F_MAY_CHANGE) || temp_pattern.data.str.len == 0)
+	if (ret == 0 || (smp.flags & SMP_F_MAY_CHANGE) || smp.data.str.len == 0)
 		goto no_cookie;
 
 	memset(&addr, 0, sizeof(addr));
 	addr.sin_family = AF_INET;
 
 	/* Considering an rdp cookie detected using acl, str ended with <cr><lf> and should return */
-	addr.sin_addr.s_addr = strtoul(temp_pattern.data.str.str, &p, 10);
+	addr.sin_addr.s_addr = strtoul(smp.data.str.str, &p, 10);
 	if (*p != '.')
 		goto no_cookie;
 	p++;
@@ -1386,14 +1386,15 @@
                 struct acl_expr *expr, struct sample *smp)
 {
 	smp->flags = SMP_F_VOL_TEST;
+	smp->type = SMP_T_UINT;
 	px = expr->args->data.prx;
 
 	if (px->srv_act)
-		temp_pattern.data.uint = px->srv_act;
+		smp->data.uint = px->srv_act;
 	else if (px->lbprm.fbck)
-		temp_pattern.data.uint = 1;
+		smp->data.uint = 1;
 	else
-		temp_pattern.data.uint = px->srv_bck;
+		smp->data.uint = px->srv_bck;
 
 	return 1;
 }
@@ -1410,6 +1411,7 @@
 	struct server *srv = expr->args->data.srv;
 
 	smp->flags = SMP_F_VOL_TEST;
+	smp->type = SMP_T_BOOL;
 	if (!(srv->state & SRV_MAINTAIN) &&
 	    (!(srv->state & SRV_CHECKED) || (srv->state & SRV_RUNNING)))
 		smp->flags |= SMP_F_SET_RES_PASS;
@@ -1429,7 +1431,8 @@
 	struct server *iterator;
 
 	smp->flags = SMP_F_VOL_TEST;
-	temp_pattern.data.uint = 0;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = 0;
 
 	for (iterator = expr->args->data.prx->srv; iterator; iterator = iterator->next) {
 		if ((iterator->state & SRV_RUNNING) == 0)
@@ -1437,11 +1440,11 @@
 
 		if (iterator->maxconn == 0 || iterator->maxqueue == 0) {
 			/* configuration is stupid */
-			temp_pattern.data.uint = -1;  /* FIXME: stupid value! */
+			smp->data.uint = -1;  /* FIXME: stupid value! */
 			return 1;
 		}
 
-		temp_pattern.data.uint += (iterator->maxconn - iterator->cur_sess)
+		smp->data.uint += (iterator->maxconn - iterator->cur_sess)
 		                       +  (iterator->maxqueue - iterator->nbpend);
 	}
 
@@ -1454,8 +1457,9 @@
                 struct acl_expr *expr, struct sample *smp)
 {
 	smp->flags = SMP_F_READ_ONLY;
-	temp_pattern.data.uint = l4->be->uuid;
-
+	smp->flags = SMP_F_VOL_TXN;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = l4->be->uuid;
 	return 1;
 }
 
@@ -1468,7 +1472,8 @@
 		return 0;
 
 	smp->flags = SMP_F_READ_ONLY;
-	temp_pattern.data.uint = target_srv(&l4->target)->puid;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = target_srv(&l4->target)->puid;
 
 	return 1;
 }
@@ -1482,7 +1487,8 @@
                        struct acl_expr *expr, struct sample *smp)
 {
 	smp->flags = SMP_F_VOL_TEST;
-	temp_pattern.data.uint = read_freq_ctr(&expr->args->data.prx->be_sess_per_sec);
+	smp->type = SMP_T_UINT;
+	smp->data.uint = read_freq_ctr(&expr->args->data.prx->be_sess_per_sec);
 	return 1;
 }
 
@@ -1495,7 +1501,8 @@
 		  struct acl_expr *expr, struct sample *smp)
 {
 	smp->flags = SMP_F_VOL_TEST;
-	temp_pattern.data.uint = expr->args->data.prx->beconn;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = expr->args->data.prx->beconn;
 	return 1;
 }
 
@@ -1508,7 +1515,8 @@
 		   struct acl_expr *expr, struct sample *smp)
 {
 	smp->flags = SMP_F_VOL_TEST;
-	temp_pattern.data.uint = expr->args->data.prx->totpend;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = expr->args->data.prx->totpend;
 	return 1;
 }
 
@@ -1527,6 +1535,7 @@
 	int nbsrv;
 
 	smp->flags = SMP_F_VOL_TEST;
+	smp->type = SMP_T_UINT;
 	px = expr->args->data.prx;
 
 	if (px->srv_act)
@@ -1537,9 +1546,9 @@
 		nbsrv = px->srv_bck;
 
 	if (nbsrv > 0)
-		temp_pattern.data.uint = (px->totpend + nbsrv - 1) / nbsrv;
+		smp->data.uint = (px->totpend + nbsrv - 1) / nbsrv;
 	else
-		temp_pattern.data.uint = px->totpend * 2;
+		smp->data.uint = px->totpend * 2;
 
 	return 1;
 }
@@ -1552,7 +1561,9 @@
 acl_fetch_srv_conn(struct proxy *px, struct session *l4, void *l7, int dir,
 		  struct acl_expr *expr, struct sample *smp)
 {
-	temp_pattern.data.uint = expr->args->data.srv->cur_sess;
+	smp->flags = SMP_F_VOL_TEST;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = expr->args->data.srv->cur_sess;
 	return 1;
 }
 
diff --git a/src/frontend.c b/src/frontend.c
index 2e91992..2e0237a 100644
--- a/src/frontend.c
+++ b/src/frontend.c
@@ -503,7 +503,9 @@
                 struct acl_expr *expr, struct sample *smp)
 {
 	smp->flags = SMP_F_READ_ONLY;
-	temp_pattern.data.uint = l4->fe->uuid;
+	smp->flags = SMP_F_VOL_SESS;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = l4->fe->uuid;
 	return 1;
 }
 
@@ -516,7 +518,8 @@
                        struct acl_expr *expr, struct sample *smp)
 {
 	smp->flags = SMP_F_VOL_TEST;
-	temp_pattern.data.uint = read_freq_ctr(&expr->args->data.prx->fe_sess_per_sec);
+	smp->type = SMP_T_UINT;
+	smp->data.uint = read_freq_ctr(&expr->args->data.prx->fe_sess_per_sec);
 	return 1;
 }
 
@@ -529,7 +532,8 @@
 		  struct acl_expr *expr, struct sample *smp)
 {
 	smp->flags = SMP_F_VOL_TEST;
-	temp_pattern.data.uint = expr->args->data.prx->feconn;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = expr->args->data.prx->feconn;
 	return 1;
 }
 
diff --git a/src/pattern.c b/src/pattern.c
index fac145f..4665be3 100644
--- a/src/pattern.c
+++ b/src/pattern.c
@@ -18,8 +18,8 @@
 #include <proto/buffers.h>
 #include <common/standard.h>
 
-/* static structure used on pattern_process if <p> is NULL*/
-struct pattern temp_pattern = { };
+/* static structure used on pattern_process if <p> is NULL */
+static struct pattern temp_pattern;
 
 /* trash chunk used for pattern conversions */
 static struct chunk trash_chunk;
diff --git a/src/proto_http.c b/src/proto_http.c
index a8aa474..e9ae1b4 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -7554,6 +7554,7 @@
 		return 0;
 
 	/* Check for a dependency on a request */
+	smp->type = SMP_T_BOOL;
 
 	if (expr->kw->requires & ACL_USE_L7REQ_ANY) {
 		if (unlikely(!s->req))
@@ -7654,14 +7655,15 @@
 	CHECK_HTTP_MESSAGE_FIRST();
 
 	meth = txn->meth;
-	temp_pattern.data.str.len = meth;
-	temp_pattern.data.str.str = NULL;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = meth;
 	if (meth == HTTP_METH_OTHER) {
 		if (txn->rsp.msg_state != HTTP_MSG_RPBEFORE)
 			/* ensure the indexes are not affected */
 			return 0;
-		temp_pattern.data.str.len = txn->req.sl.rq.m_l;
-		temp_pattern.data.str.str = txn->req.buf->p + txn->req.sol;
+		smp->type = SMP_T_CSTR;
+		smp->data.str.len = txn->req.sl.rq.m_l;
+		smp->data.str.str = txn->req.buf->p + txn->req.sol;
 	}
 	smp->flags = SMP_F_READ_ONLY | SMP_F_VOL_1ST;
 	return 1;
@@ -7673,9 +7675,9 @@
 	int icase;
 
 
-	if (temp_pattern.data.str.str == NULL) {
+	if (smp->type == SMP_T_UINT) {
 		/* well-known method */
-		if (temp_pattern.data.str.len == pattern->val.i)
+		if (smp->data.uint == pattern->val.i)
 			return ACL_PAT_PASS;
 		return ACL_PAT_FAIL;
 	}
@@ -7685,12 +7687,12 @@
 		return ACL_PAT_FAIL;
 
 	/* Other method, we must compare the strings */
-	if (pattern->len != temp_pattern.data.str.len)
+	if (pattern->len != smp->data.str.len)
 		return ACL_PAT_FAIL;
 
 	icase = pattern->flags & ACL_PAT_F_IGNORE_CASE;
-	if ((icase && strncasecmp(pattern->ptr.str, temp_pattern.data.str.str, temp_pattern.data.str.len) != 0) ||
-	    (!icase && strncmp(pattern->ptr.str, temp_pattern.data.str.str, temp_pattern.data.str.len) != 0))
+	if ((icase && strncasecmp(pattern->ptr.str, smp->data.str.str, smp->data.str.len) != 0) ||
+	    (!icase && strncmp(pattern->ptr.str, smp->data.str.str, smp->data.str.len) != 0))
 		return ACL_PAT_FAIL;
 	return ACL_PAT_PASS;
 }
@@ -7724,8 +7726,9 @@
 	if (len <= 0)
 		return 0;
 
-	temp_pattern.data.str.str = ptr;
-	temp_pattern.data.str.len = len;
+	smp->type = SMP_T_CSTR;
+	smp->data.str.str = ptr;
+	smp->data.str.len = len;
 
 	smp->flags = SMP_F_READ_ONLY | SMP_F_VOL_1ST;
 	return 1;
@@ -7748,8 +7751,9 @@
 	if (len <= 0)
 		return 0;
 
-	temp_pattern.data.str.str = ptr;
-	temp_pattern.data.str.len = len;
+	smp->type = SMP_T_CSTR;
+	smp->data.str.str = ptr;
+	smp->data.str.len = len;
 
 	smp->flags = SMP_F_READ_ONLY | SMP_F_VOL_1ST;
 	return 1;
@@ -7769,7 +7773,8 @@
 	len = txn->rsp.sl.st.c_l;
 	ptr = txn->rsp.buf->p + txn->rsp.sol + txn->rsp.sl.st.c;
 
-	temp_pattern.data.uint = __strl2ui(ptr, len);
+	smp->type = SMP_T_UINT;
+	smp->data.uint = __strl2ui(ptr, len);
 	smp->flags = SMP_F_VOL_1ST;
 	return 1;
 }
@@ -7783,10 +7788,9 @@
 
 	CHECK_HTTP_MESSAGE_FIRST();
 
-	temp_pattern.data.str.len = txn->req.sl.rq.u_l;
-	temp_pattern.data.str.str = txn->req.buf->p + txn->req.sol + txn->req.sl.rq.u;
-
-	/* we do not need to set READ_ONLY because the data is in a buffer */
+	smp->type = SMP_T_CSTR;
+	smp->data.str.len = txn->req.sl.rq.u_l;
+	smp->data.str.str = txn->req.buf->p + txn->req.sol + txn->req.sl.rq.u;
 	smp->flags = SMP_F_VOL_1ST;
 	return 1;
 }
@@ -7803,8 +7807,8 @@
 	url2sa(txn->req.buf->p + txn->req.sol + txn->req.sl.rq.u, txn->req.sl.rq.u_l, &l4->req->cons->addr.to);
 	if (((struct sockaddr_in *)&l4->req->cons->addr.to)->sin_family != AF_INET)
 		return 0;
-	temp_pattern.type = SMP_T_IPV4;
-	temp_pattern.data.ipv4 = ((struct sockaddr_in *)&l4->req->cons->addr.to)->sin_addr;
+	smp->type = SMP_T_IPV4;
+	smp->data.ipv4 = ((struct sockaddr_in *)&l4->req->cons->addr.to)->sin_addr;
 
 	/*
 	 * If we are parsing url in frontend space, we prepare backend stage
@@ -7827,7 +7831,8 @@
 
 	/* Same optimization as url_ip */
 	url2sa(txn->req.buf->p + txn->req.sol + txn->req.sl.rq.u, txn->req.sl.rq.u_l, &l4->req->cons->addr.to);
-	temp_pattern.data.uint = ntohs(((struct sockaddr_in *)&l4->req->cons->addr.to)->sin_port);
+	smp->type = SMP_T_UINT;
+	smp->data.uint = ntohs(((struct sockaddr_in *)&l4->req->cons->addr.to)->sin_port);
 
 	if (px->options & PR_O_HTTP_PROXY)
 		l4->flags |= SN_ADDR_SET;
@@ -7860,8 +7865,9 @@
 	if (http_find_header2(expr->args->data.str.str, expr->args->data.str.len, msg->buf->p + msg->sol, idx, ctx)) {
 		smp->flags |= SMP_F_NOT_LAST;
 		smp->flags |= SMP_F_VOL_HDR;
-		temp_pattern.data.str.str = (char *)ctx->line + ctx->val;
-		temp_pattern.data.str.len = ctx->vlen;
+		smp->type = SMP_T_CSTR;
+		smp->data.str.str = (char *)ctx->line + ctx->val;
+		smp->data.str.len = ctx->vlen;
 
 		return 1;
 	}
@@ -7894,7 +7900,8 @@
 	while (http_find_header2(expr->args->data.str.str, expr->args->data.str.len, msg->buf->p + msg->sol, idx, &ctx))
 		cnt++;
 
-	temp_pattern.data.uint = cnt;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = cnt;
 	smp->flags = SMP_F_VOL_HDR;
 	return 1;
 }
@@ -7908,8 +7915,10 @@
 {
 	int ret = acl_fetch_hdr(px, l4, l7, dir, expr, smp);
 
-	if (ret > 0)
-		temp_pattern.data.uint = strl2ic(temp_pattern.data.str.str, temp_pattern.data.str.len);
+	if (ret > 0) {
+		smp->type = SMP_T_UINT;
+		smp->data.uint = strl2ic(smp->data.str.str, smp->data.str.len);
+	}
 
 	return ret;
 }
@@ -7923,8 +7932,8 @@
 	int ret;
 
 	while ((ret = acl_fetch_hdr(px, l4, l7, dir, expr, smp)) > 0) {
-		temp_pattern.type = SMP_T_IPV4;
-		if (url2ipv4((char *)temp_pattern.data.str.str, &temp_pattern.data.ipv4))
+		smp->type = SMP_T_IPV4;
+		if (url2ipv4((char *)smp->data.str.str, &smp->data.ipv4))
 			break;
 		/* if the header doesn't match an IP address, fetch next one */
 	}
@@ -7949,12 +7958,13 @@
 		return 0;
 
 	/* OK, we got the '/' ! */
-	temp_pattern.data.str.str = ptr;
+	smp->type = SMP_T_CSTR;
+	smp->data.str.str = ptr;
 
 	while (ptr < end && *ptr != '?')
 		ptr++;
 
-	temp_pattern.data.str.len = ptr - temp_pattern.data.str.str;
+	smp->data.str.len = ptr - smp->data.str.str;
 
 	/* we do not need to set READ_ONLY because the data is in a buffer */
 	smp->flags = SMP_F_VOL_1ST;
@@ -7971,6 +7981,7 @@
 
 	CHECK_HTTP_MESSAGE_FIRST();
 
+	smp->type = SMP_T_BOOL;
 	smp->flags |= SMP_F_SET_RES_PASS;
 	return 1;
 }
@@ -7983,6 +7994,7 @@
 	if (!s)
 		return 0;
 
+	smp->type = SMP_T_BOOL;
 	if (s->txn.flags & TX_NOT_FIRST)
 		smp->flags |= SMP_F_SET_RES_FAIL;
 	else
@@ -8005,6 +8017,7 @@
 	if (!get_http_auth(l4))
 		return 0;
 
+	smp->type = SMP_T_BOOL;
 	if (check_user(expr->args->data.usr, 0, l4->txn.auth.user, l4->txn.auth.pass))
 		smp->flags |= SMP_F_SET_RES_PASS;
 	else
@@ -8164,13 +8177,14 @@
 			smp->ctx.a[1] = smp->ctx.a[0] + ctx->vlen;
 		}
 
+		smp->type = SMP_T_CSTR;
 		smp->ctx.a[0] = extract_cookie_value(smp->ctx.a[0], smp->ctx.a[1],
 						 expr->args->data.str.str, expr->args->data.str.len,
 						 (dir & ACL_DIR_MASK) == ACL_DIR_REQ,
-						 &temp_pattern.data.str.str,
-						 &temp_pattern.data.str.len);
+						 &smp->data.str.str,
+						 &smp->data.str.len);
 		if (smp->ctx.a[0]) {
-			/* one value was returned into temp_pattern.data.str.{str,len} */
+			/* one value was returned into smp->data.str.{str,len} */
 			smp->flags |= SMP_F_NOT_LAST;
 			smp->flags |= SMP_F_VOL_HDR;
 			return 1;
@@ -8235,16 +8249,17 @@
 			val_end = val_beg + ctx.vlen;
 		}
 
+		smp->type = SMP_T_CSTR;
 		while ((val_beg = extract_cookie_value(val_beg, val_end,
 						       expr->args->data.str.str, expr->args->data.str.len,
 						       (dir & ACL_DIR_MASK) == ACL_DIR_REQ,
-						       &temp_pattern.data.str.str,
-						       &temp_pattern.data.str.len))) {
+						       &smp->data.str.str,
+						       &smp->data.str.len))) {
 			cnt++;
 		}
 	}
 
-	temp_pattern.data.uint = cnt;
+	smp->data.uint = cnt;
 	smp->flags |= SMP_F_VOL_HDR;
 	return 1;
 }
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index eb35a85..dc32a9f 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -1258,12 +1258,12 @@
 {
 	switch (l4->si[0].addr.from.ss_family) {
 	case AF_INET:
-		temp_pattern.data.ipv4 = ((struct sockaddr_in *)&l4->si[0].addr.from)->sin_addr;
-		temp_pattern.type = SMP_T_IPV4;
+		smp->data.ipv4 = ((struct sockaddr_in *)&l4->si[0].addr.from)->sin_addr;
+		smp->type = SMP_T_IPV4;
 		break;
 	case AF_INET6:
-		temp_pattern.data.ipv6 = ((struct sockaddr_in6 *)(&l4->si[0].addr.from))->sin6_addr;
-		temp_pattern.type = SMP_T_IPV6;
+		smp->data.ipv6 = ((struct sockaddr_in6 *)(&l4->si[0].addr.from))->sin6_addr;
+		smp->type = SMP_T_IPV6;
 		break;
 	default:
 		return 0;
@@ -1302,7 +1302,8 @@
 acl_fetch_sport(struct proxy *px, struct session *l4, void *l7, int dir,
                 struct acl_expr *expr, struct sample *smp)
 {
-	if (!(temp_pattern.data.uint = get_host_port(&l4->si[0].addr.from)))
+	smp->type = SMP_T_UINT;
+	if (!(smp->data.uint = get_host_port(&l4->si[0].addr.from)))
 		return 0;
 
 	smp->flags = 0;
@@ -1319,12 +1320,12 @@
 
 	switch (l4->si[0].addr.to.ss_family) {
 	case AF_INET:
-		temp_pattern.data.ipv4 = ((struct sockaddr_in *)&l4->si[0].addr.to)->sin_addr;
-		temp_pattern.type = SMP_T_IPV4;
+		smp->data.ipv4 = ((struct sockaddr_in *)&l4->si[0].addr.to)->sin_addr;
+		smp->type = SMP_T_IPV4;
 		break;
 	case AF_INET6:
-		temp_pattern.data.ipv6 = ((struct sockaddr_in6 *)(&l4->si[0].addr.to))->sin6_addr;
-		temp_pattern.type = SMP_T_IPV6;
+		smp->data.ipv6 = ((struct sockaddr_in6 *)(&l4->si[0].addr.to))->sin6_addr;
+		smp->type = SMP_T_IPV6;
 		break;
 	default:
 		return 0;
@@ -1370,7 +1371,8 @@
 {
 	stream_sock_get_to_addr(&l4->si[0]);
 
-	if (!(temp_pattern.data.uint = get_host_port(&l4->si[0].addr.to)))
+	smp->type = SMP_T_UINT;
+	if (!(smp->data.uint = get_host_port(&l4->si[0].addr.to)))
 		return 0;
 
 	smp->flags = 0;
@@ -1486,10 +1488,10 @@
 	expr.args = args;
 
 	ret = acl_fetch_rdp_cookie(px, l4, NULL, ACL_DIR_REQ, &expr, &smp);
-	if (ret == 0 || (smp.flags & SMP_F_MAY_CHANGE) || temp_pattern.data.str.len == 0)
+	if (ret == 0 || (smp.flags & SMP_F_MAY_CHANGE) || smp.data.str.len == 0)
 		return 0;
 
-	data->str = temp_pattern.data.str;
+	data->str = smp.data.str;
 	return 1;
 }
 
diff --git a/src/protocols.c b/src/protocols.c
index 3ad8c2e..12d719a 100644
--- a/src/protocols.c
+++ b/src/protocols.c
@@ -328,7 +328,8 @@
 acl_fetch_dconn(struct proxy *px, struct session *l4, void *l7, int dir,
                 struct acl_expr *expr, struct sample *smp)
 {
-	temp_pattern.data.uint = l4->listener->nbconn;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = l4->listener->nbconn;
 	return 1;
 }
 
@@ -338,7 +339,8 @@
                 struct acl_expr *expr, struct sample *smp)
 {
 	smp->flags = SMP_F_READ_ONLY;
-	temp_pattern.data.uint = l4->listener->luid;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = l4->listener->luid;
 	return 1;
 }
 
diff --git a/src/session.c b/src/session.c
index 54bd7a0..b4c0a82 100644
--- a/src/session.c
+++ b/src/session.c
@@ -2311,12 +2311,13 @@
 acl_fetch_get_gpc0(struct stktable *table, struct sample *smp, struct stksess *ts)
 {
 	smp->flags = SMP_F_VOL_TEST;
-	temp_pattern.data.uint = 0;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = 0;
 	if (ts != NULL) {
 		void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_GPC0);
 		if (!ptr)
 			return 0; /* parameter not stored */
-		temp_pattern.data.uint = stktable_data_cast(ptr, gpc0);
+		smp->data.uint = stktable_data_cast(ptr, gpc0);
 	}
 	return 1;
 }
@@ -2370,12 +2371,13 @@
 acl_fetch_inc_gpc0(struct stktable *table, struct sample *smp, struct stksess *ts)
 {
 	smp->flags = SMP_F_VOL_TEST;
-	temp_pattern.data.uint = 0;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = 0;
 	if (ts != NULL) {
 		void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_GPC0);
 		if (!ptr)
 			return 0; /* parameter not stored */
-		temp_pattern.data.uint = ++stktable_data_cast(ptr, gpc0);
+		smp->data.uint = ++stktable_data_cast(ptr, gpc0);
 	}
 	return 1;
 }
@@ -2429,12 +2431,13 @@
 acl_fetch_clr_gpc0(struct stktable *table, struct sample *smp, struct stksess *ts)
 {
 	smp->flags = SMP_F_VOL_TEST;
-	temp_pattern.data.uint = 0;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = 0;
 	if (ts != NULL) {
 		void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_GPC0);
 		if (!ptr)
 			return 0; /* parameter not stored */
-		temp_pattern.data.uint = stktable_data_cast(ptr, gpc0);
+		smp->data.uint = stktable_data_cast(ptr, gpc0);
 		stktable_data_cast(ptr, gpc0) = 0;
 	}
 	return 1;
@@ -2487,12 +2490,13 @@
 acl_fetch_conn_cnt(struct stktable *table, struct sample *smp, struct stksess *ts)
 {
 	smp->flags = SMP_F_VOL_TEST;
-	temp_pattern.data.uint = 0;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = 0;
 	if (ts != NULL) {
 		void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_CONN_CNT);
 		if (!ptr)
 			return 0; /* parameter not stored */
-		temp_pattern.data.uint = stktable_data_cast(ptr, conn_cnt);
+		smp->data.uint = stktable_data_cast(ptr, conn_cnt);
 	}
 	return 1;
 }
@@ -2542,12 +2546,13 @@
 acl_fetch_conn_rate(struct stktable *table, struct sample *smp, struct stksess *ts)
 {
 	smp->flags = SMP_F_VOL_TEST;
-	temp_pattern.data.uint = 0;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = 0;
 	if (ts != NULL) {
 		void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_CONN_RATE);
 		if (!ptr)
 			return 0; /* parameter not stored */
-		temp_pattern.data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, conn_rate),
+		smp->data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, conn_rate),
 					       table->data_arg[STKTABLE_DT_CONN_RATE].u);
 	}
 	return 1;
@@ -2623,7 +2628,8 @@
 	if (!ptr)
 		return 0; /* parameter not stored in this table */
 
-	temp_pattern.data.uint = ++stktable_data_cast(ptr, conn_cnt);
+	smp->type = SMP_T_UINT;
+	smp->data.uint = ++stktable_data_cast(ptr, conn_cnt);
 	smp->flags = SMP_F_VOL_TEST;
 	return 1;
 }
@@ -2633,13 +2639,14 @@
 acl_fetch_conn_cur(struct stktable *table, struct sample *smp, struct stksess *ts)
 {
 	smp->flags = SMP_F_VOL_TEST;
-	temp_pattern.data.uint = 0;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = 0;
 
 	if (ts != NULL) {
 		void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_CONN_CUR);
 		if (!ptr)
 			return 0; /* parameter not stored */
-		temp_pattern.data.uint = stktable_data_cast(ptr, conn_cur);
+		smp->data.uint = stktable_data_cast(ptr, conn_cur);
 	}
 	return 1;
 }
@@ -2689,12 +2696,13 @@
 acl_fetch_sess_cnt(struct stktable *table, struct sample *smp, struct stksess *ts)
 {
 	smp->flags = SMP_F_VOL_TEST;
-	temp_pattern.data.uint = 0;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = 0;
 	if (ts != NULL) {
 		void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_SESS_CNT);
 		if (!ptr)
 			return 0; /* parameter not stored */
-		temp_pattern.data.uint = stktable_data_cast(ptr, sess_cnt);
+		smp->data.uint = stktable_data_cast(ptr, sess_cnt);
 	}
 	return 1;
 }
@@ -2744,12 +2752,13 @@
 acl_fetch_sess_rate(struct stktable *table, struct sample *smp, struct stksess *ts)
 {
 	smp->flags = SMP_F_VOL_TEST;
-	temp_pattern.data.uint = 0;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = 0;
 	if (ts != NULL) {
 		void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_SESS_RATE);
 		if (!ptr)
 			return 0; /* parameter not stored */
-		temp_pattern.data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, sess_rate),
+		smp->data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, sess_rate),
 					       table->data_arg[STKTABLE_DT_SESS_RATE].u);
 	}
 	return 1;
@@ -2804,12 +2813,13 @@
 acl_fetch_http_req_cnt(struct stktable *table, struct sample *smp, struct stksess *ts)
 {
 	smp->flags = SMP_F_VOL_TEST;
-	temp_pattern.data.uint = 0;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = 0;
 	if (ts != NULL) {
 		void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_HTTP_REQ_CNT);
 		if (!ptr)
 			return 0; /* parameter not stored */
-		temp_pattern.data.uint = stktable_data_cast(ptr, http_req_cnt);
+		smp->data.uint = stktable_data_cast(ptr, http_req_cnt);
 	}
 	return 1;
 }
@@ -2859,12 +2869,13 @@
 acl_fetch_http_req_rate(struct stktable *table, struct sample *smp, struct stksess *ts)
 {
 	smp->flags = SMP_F_VOL_TEST;
-	temp_pattern.data.uint = 0;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = 0;
 	if (ts != NULL) {
 		void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_HTTP_REQ_RATE);
 		if (!ptr)
 			return 0; /* parameter not stored */
-		temp_pattern.data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, http_req_rate),
+		smp->data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, http_req_rate),
 					       table->data_arg[STKTABLE_DT_HTTP_REQ_RATE].u);
 	}
 	return 1;
@@ -2919,12 +2930,13 @@
 acl_fetch_http_err_cnt(struct stktable *table, struct sample *smp, struct stksess *ts)
 {
 	smp->flags = SMP_F_VOL_TEST;
-	temp_pattern.data.uint = 0;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = 0;
 	if (ts != NULL) {
 		void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_HTTP_ERR_CNT);
 		if (!ptr)
 			return 0; /* parameter not stored */
-		temp_pattern.data.uint = stktable_data_cast(ptr, http_err_cnt);
+		smp->data.uint = stktable_data_cast(ptr, http_err_cnt);
 	}
 	return 1;
 }
@@ -2974,12 +2986,13 @@
 acl_fetch_http_err_rate(struct stktable *table, struct sample *smp, struct stksess *ts)
 {
 	smp->flags = SMP_F_VOL_TEST;
-	temp_pattern.data.uint = 0;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = 0;
 	if (ts != NULL) {
 		void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_HTTP_ERR_RATE);
 		if (!ptr)
 			return 0; /* parameter not stored */
-		temp_pattern.data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, http_err_rate),
+		smp->data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, http_err_rate),
 					       table->data_arg[STKTABLE_DT_HTTP_ERR_RATE].u);
 	}
 	return 1;
@@ -3034,13 +3047,14 @@
 acl_fetch_kbytes_in(struct stktable *table, struct sample *smp, struct stksess *ts)
 {
 	smp->flags = SMP_F_VOL_TEST;
-	temp_pattern.data.uint = 0;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = 0;
 
 	if (ts != NULL) {
 		void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_BYTES_IN_CNT);
 		if (!ptr)
 			return 0; /* parameter not stored */
-		temp_pattern.data.uint = stktable_data_cast(ptr, bytes_in_cnt) >> 10;
+		smp->data.uint = stktable_data_cast(ptr, bytes_in_cnt) >> 10;
 	}
 	return 1;
 }
@@ -3096,12 +3110,13 @@
 acl_fetch_bytes_in_rate(struct stktable *table, struct sample *smp, struct stksess *ts)
 {
 	smp->flags = SMP_F_VOL_TEST;
-	temp_pattern.data.uint = 0;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = 0;
 	if (ts != NULL) {
 		void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_BYTES_IN_RATE);
 		if (!ptr)
 			return 0; /* parameter not stored */
-		temp_pattern.data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, bytes_in_rate),
+		smp->data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, bytes_in_rate),
 					       table->data_arg[STKTABLE_DT_BYTES_IN_RATE].u);
 	}
 	return 1;
@@ -3156,13 +3171,14 @@
 acl_fetch_kbytes_out(struct stktable *table, struct sample *smp, struct stksess *ts)
 {
 	smp->flags = SMP_F_VOL_TEST;
-	temp_pattern.data.uint = 0;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = 0;
 
 	if (ts != NULL) {
 		void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_BYTES_OUT_CNT);
 		if (!ptr)
 			return 0; /* parameter not stored */
-		temp_pattern.data.uint = stktable_data_cast(ptr, bytes_out_cnt) >> 10;
+		smp->data.uint = stktable_data_cast(ptr, bytes_out_cnt) >> 10;
 	}
 	return 1;
 }
@@ -3218,12 +3234,13 @@
 acl_fetch_bytes_out_rate(struct stktable *table, struct sample *smp, struct stksess *ts)
 {
 	smp->flags = SMP_F_VOL_TEST;
-	temp_pattern.data.uint = 0;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = 0;
 	if (ts != NULL) {
 		void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_BYTES_OUT_RATE);
 		if (!ptr)
 			return 0; /* parameter not stored */
-		temp_pattern.data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, bytes_out_rate),
+		smp->data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, bytes_out_rate),
 					       table->data_arg[STKTABLE_DT_BYTES_OUT_RATE].u);
 	}
 	return 1;
@@ -3281,7 +3298,8 @@
                     struct acl_expr *expr, struct sample *smp)
 {
 	smp->flags = SMP_F_VOL_TEST;
-	temp_pattern.data.uint = expr->args->data.prx->table.current;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = expr->args->data.prx->table.current;
 	return 1;
 }
 
@@ -3294,7 +3312,8 @@
 {
 	px = expr->args->data.prx;
 	smp->flags = SMP_F_VOL_TEST;
-	temp_pattern.data.uint = px->table.size - px->table.current;
+	smp->type = SMP_T_UINT;
+	smp->data.uint = px->table.size - px->table.current;
 	return 1;
 }