MINOR: pattern: Each pattern expression element store the reference struct.

Now, each pattern entry known the original "struct pat_ref_elt" from
that was built. This patch permit to delete each pattern entry without
confusion. After this patch, each reference can use his pointer to be
targeted.
diff --git a/include/types/pattern.h b/include/types/pattern.h
index ac76e37..7fa860f 100644
--- a/include/types/pattern.h
+++ b/include/types/pattern.h
@@ -125,6 +125,7 @@
  */
 struct pattern_tree {
 	struct sample_storage *smp;
+	struct pat_ref_elt *ref;
 	struct ebmb_node node;
 };
 
@@ -164,7 +165,7 @@
 	int flags;                      /* expr or pattern flags. */
 	struct sample_storage *smp;     /* used to store a pointer to sample value associated
 	                                   with the match. It is used with maps */
-
+	struct pat_ref_elt *ref;
 };
 
 /* This struct is just used for chaining patterns */
diff --git a/src/pattern.c b/src/pattern.c
index da50f73..eac123d 100644
--- a/src/pattern.c
+++ b/src/pattern.c
@@ -478,6 +478,7 @@
 			if (fill) {
 				elt = ebmb_entry(node, struct pattern_tree, node);
 				static_pattern.smp = elt->smp;
+				static_pattern.ref = elt->ref;
 				static_pattern.flags = PAT_F_TREE;
 				static_pattern.type = SMP_T_STR;
 				static_pattern.ptr.str = (char *)elt->node.key;
@@ -764,6 +765,7 @@
 			if (fill) {
 				elt = ebmb_entry(node, struct pattern_tree, node);
 				static_pattern.smp = elt->smp;
+				static_pattern.ref = elt->ref;
 				static_pattern.flags = PAT_F_TREE;
 				static_pattern.type = SMP_T_IPV4;
 				memcpy(&static_pattern.val.ipv4.addr.s_addr, elt->node.key, 4);
@@ -785,6 +787,7 @@
 			if (fill) {
 				elt = ebmb_entry(node, struct pattern_tree, node);
 				static_pattern.smp = elt->smp;
+				static_pattern.ref = elt->ref;
 				static_pattern.flags = PAT_F_TREE;
 				static_pattern.type = SMP_T_IPV6;
 				memcpy(&static_pattern.val.ipv6.addr, elt->node.key, 16);
@@ -804,6 +807,7 @@
 			if (fill) {
 				elt = ebmb_entry(node, struct pattern_tree, node);
 				static_pattern.smp = elt->smp;
+				static_pattern.ref = elt->ref;
 				static_pattern.flags = PAT_F_TREE;
 				static_pattern.type = SMP_T_IPV6;
 				memcpy(&static_pattern.val.ipv6.addr, elt->node.key, 16);
@@ -837,6 +841,7 @@
 				if (fill) {
 					elt = ebmb_entry(node, struct pattern_tree, node);
 					static_pattern.smp = elt->smp;
+					static_pattern.ref = elt->ref;
 					static_pattern.flags = PAT_F_TREE;
 					static_pattern.type = SMP_T_IPV4;
 					memcpy(&static_pattern.val.ipv4.addr.s_addr, elt->node.key, 4);
@@ -1087,6 +1092,7 @@
 
 			/* copy the pointer to sample associated to this node */
 			node->smp = pat->smp;
+			node->ref = pat->ref;
 
 			/* FIXME: insert <addr>/<mask> into the tree here */
 			memcpy(node->node.key, &pat->val.ipv4.addr, 4); /* network byte order */
@@ -1112,6 +1118,7 @@
 
 		/* copy the pointer to sample associated to this node */
 		node->smp = pat->smp;
+		node->ref = pat->ref;
 
 		/* FIXME: insert <addr>/<mask> into the tree here */
 		memcpy(node->node.key, &pat->val.ipv6.addr, 16); /* network byte order */
@@ -1154,6 +1161,7 @@
 
 	/* copy the pointer to sample associated to this node */
 	node->smp = pat->smp;
+	node->ref = pat->ref;
 
 	/* copy the string */
 	memcpy(node->node.key, pat->ptr.str, len);
@@ -1819,6 +1827,7 @@
 	memset(&pattern, 0, sizeof(pattern));
 	pattern.flags = patflags;
 	pattern.smp = smp;
+	pattern.ref = elt;
 
 	/* parse pattern */
 	if (!expr->pat_head->parse(elt->pattern, &pattern, err)) {
@@ -2125,6 +2134,7 @@
 	if (!head->match) {
 		if (fill) {
 			static_pattern.smp = NULL;
+			static_pattern.ref = NULL;
 			static_pattern.flags = 0;
 			static_pattern.type = SMP_T_UINT;
 			static_pattern.val.i = 1;