MEDIUM: pattern: only match patterns that match the current generation

Instead of matching any pattern found in the tree, only match those
matching the current generation of entries. This will make sure that
reloads are atomic, regardless of the time they take to complete, and
that newly added data are not matched until the whole reference is
committed. For consistency we proceed the same way on "show map" and
"show acl".

This will have no impact for now since generations are not used.
diff --git a/src/map.c b/src/map.c
index ee022e2..cd356b9 100644
--- a/src/map.c
+++ b/src/map.c
@@ -368,6 +368,9 @@
 
 			elt = LIST_ELEM(appctx->ctx.map.bref.ref, struct pat_ref_elt *, list);
 
+			if (elt->gen_id != appctx->ctx.map.ref->curr_gen)
+				goto skip;
+
 			/* build messages */
 			if (elt->sample)
 				chunk_appendf(&trash, "%p %s %s\n",
@@ -386,7 +389,7 @@
 				si_rx_room_blk(si);
 				return 0;
 			}
-
+		skip:
 			/* get next list entry and check the end of the list */
 			appctx->ctx.map.bref.ref = elt->list.n;
 		}