MEDIUM: pattern: add delete functions

This commit adds a delete function for patterns. It looks up all
instances of the pattern to delete and deletes them all. The fetch
keyword declarations have been extended to point to the appropriate
delete function.
diff --git a/include/proto/pattern.h b/include/proto/pattern.h
index e2801a0..63e02e7 100644
--- a/include/proto/pattern.h
+++ b/include/proto/pattern.h
@@ -75,6 +75,20 @@
 
 /*
  *
+ * The following functions search pattern <pattern> into the pattern
+ * expression <expr>. If the pattern is found, delete it. This function
+ * never fails.
+ *
+ */
+void pat_del_list_val(struct pattern_expr *expr, struct pattern *pat);
+void pat_del_tree_ip(struct pattern_expr *expr, struct pattern *pat);
+void pat_del_list_ptr(struct pattern_expr *expr, struct pattern *pat);
+void pat_del_tree_str(struct pattern_expr *expr, struct pattern *pat);
+void pat_del_list_str(struct pattern_expr *expr, struct pattern *pat);
+void pat_del_list_reg(struct pattern_expr *expr, struct pattern *pat);
+
+/*
+ *
  * The following functions are general purpose pattern matching functions.
  *
  */
@@ -162,6 +176,7 @@
 void pattern_prune_expr(struct pattern_expr *expr);
 void pattern_init_expr(struct pattern_expr *expr);
 int pattern_lookup(const char *args, struct pattern_expr *expr, struct pattern_list **pat_elt, struct pattern_tree **idx_elt, char **err);
+int pattern_delete(const char *key, struct pattern_expr *expr, char **err);
 
 
 #endif
diff --git a/include/types/acl.h b/include/types/acl.h
index 49c03cf..96b30bd 100644
--- a/include/types/acl.h
+++ b/include/types/acl.h
@@ -94,6 +94,7 @@
 	char *fetch_kw;
 	int (*parse)(const char *text, struct pattern *pattern, char **err);
 	int (*index)(struct pattern_expr *expr, struct pattern *pattern, char **err);
+	void (*delete)(struct pattern_expr *expr, struct pattern *pattern);
 	struct pattern *(*match)(struct sample *smp, struct pattern_expr *expr, int fill);
 	/* must be after the config params */
 	struct sample_fetch *smp; /* the sample fetch we depend on */
diff --git a/include/types/pattern.h b/include/types/pattern.h
index 9622888..2224e4c 100644
--- a/include/types/pattern.h
+++ b/include/types/pattern.h
@@ -157,6 +157,7 @@
 struct pattern_expr {
 	int (*parse)(const char *text, struct pattern *pattern, char **err);
 	int (*index)(struct pattern_expr *, struct pattern *, char **);
+	void (*delete)(struct pattern_expr *, struct pattern *);
 	struct pattern *(*match)(struct sample *, struct pattern_expr *, int);
 	struct list patterns;         /* list of acl_patterns */
 	struct eb_root pattern_tree;  /* may be used for lookup in large datasets */
@@ -166,7 +167,8 @@
 extern char *pat_match_names[PAT_MATCH_NUM];
 extern int (*pat_parse_fcts[PAT_MATCH_NUM])(const char *, struct pattern *, char **);
 extern int (*pat_index_fcts[PAT_MATCH_NUM])(struct pattern_expr *, struct pattern *, char **);
-struct pattern *(*pat_match_fcts[PAT_MATCH_NUM])(struct sample *, struct pattern_expr *, int);
+extern void (*pat_delete_fcts[PAT_MATCH_NUM])(struct pattern_expr *, struct pattern *);
+extern struct pattern *(*pat_match_fcts[PAT_MATCH_NUM])(struct sample *, struct pattern_expr *, int);
 extern int pat_match_types[PAT_MATCH_NUM];
 
 #endif /* _TYPES_PATTERN_H */