]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: pattern: remove pat_delete_fcts[] and pattern_head->delete()
authorWilly Tarreau <w@1wt.eu>
Mon, 2 Nov 2020 19:20:47 +0000 (20:20 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 5 Nov 2020 18:27:09 +0000 (19:27 +0100)
These ones are not used anymore, so let's remove them to remove a bit
of the complexity. The ACL keyword's delete() function could be removed
as well, though most keyword declarations are positional and we have a
high risk of introducing a mistake here, so let's not touch the ACL part.

include/haproxy/pattern-t.h
include/haproxy/pattern.h
src/acl.c
src/map.c
src/pattern.c

index 8c01760c03d2866d2bac3b008a2a71ac13e9059d..477b2bbc6a40e043c203e46b93307a4954727291 100644 (file)
@@ -216,7 +216,6 @@ struct pattern_head {
        int (*parse)(const char *text, struct pattern *pattern, int flags, char **err);
        int (*parse_smp)(const char *text, struct sample_data *data);
        int (*index)(struct pattern_expr *, struct pattern *, char **);
-       void (*delete)(struct pat_ref *, struct pat_ref_elt *);
        void (*prune)(struct pattern_expr *);
        struct pattern *(*match)(struct sample *, struct pattern_expr *, int);
        int expect_type; /* type of the expected sample (SMP_T_*) */
index 844bc9102ba1ffa65f0b2e230198e320946652ab..b6f1a38560f504770a5502126b48f29138fb6863 100644 (file)
@@ -34,7 +34,6 @@ extern int pat_match_types[PAT_MATCH_NUM];
 
 extern int (*pat_parse_fcts[PAT_MATCH_NUM])(const char *, struct pattern *, int, char **);
 extern int (*pat_index_fcts[PAT_MATCH_NUM])(struct pattern_expr *, struct pattern *, char **);
-extern void (*pat_delete_fcts[PAT_MATCH_NUM])(struct pat_ref *, struct pat_ref_elt *);
 extern void (*pat_prune_fcts[PAT_MATCH_NUM])(struct pattern_expr *);
 extern struct pattern *(*pat_match_fcts[PAT_MATCH_NUM])(struct sample *, struct pattern_expr *, int);
 
index 5dc77a0fdb4ef54a74631f726c16e428e6c82daf..abfcf21ccfe36ba84c34b914093782ec3cd0dd3e 100644 (file)
--- a/src/acl.c
+++ b/src/acl.c
@@ -340,7 +340,6 @@ struct acl_expr *parse_acl_expr(const char **args, char **err, struct arg_list *
                expr->pat.parse  = aclkw->parse  ? aclkw->parse  : pat_parse_fcts[aclkw->match_type];
                expr->pat.index  = aclkw->index  ? aclkw->index  : pat_index_fcts[aclkw->match_type];
                expr->pat.match  = aclkw->match  ? aclkw->match  : pat_match_fcts[aclkw->match_type];
-               expr->pat.delete = aclkw->delete ? aclkw->delete : pat_delete_fcts[aclkw->match_type];
                expr->pat.prune  = aclkw->prune  ? aclkw->prune  : pat_prune_fcts[aclkw->match_type];
        }
 
@@ -354,7 +353,6 @@ struct acl_expr *parse_acl_expr(const char **args, char **err, struct arg_list *
                        expr->pat.parse = pat_parse_fcts[PAT_MATCH_BOOL];
                        expr->pat.index = pat_index_fcts[PAT_MATCH_BOOL];
                        expr->pat.match = pat_match_fcts[PAT_MATCH_BOOL];
-                       expr->pat.delete = pat_delete_fcts[PAT_MATCH_BOOL];
                        expr->pat.prune = pat_prune_fcts[PAT_MATCH_BOOL];
                        expr->pat.expect_type = pat_match_types[PAT_MATCH_BOOL];
                        break;
@@ -362,7 +360,6 @@ struct acl_expr *parse_acl_expr(const char **args, char **err, struct arg_list *
                        expr->pat.parse = pat_parse_fcts[PAT_MATCH_INT];
                        expr->pat.index = pat_index_fcts[PAT_MATCH_INT];
                        expr->pat.match = pat_match_fcts[PAT_MATCH_INT];
-                       expr->pat.delete = pat_delete_fcts[PAT_MATCH_INT];
                        expr->pat.prune = pat_prune_fcts[PAT_MATCH_INT];
                        expr->pat.expect_type = pat_match_types[PAT_MATCH_INT];
                        break;
@@ -372,7 +369,6 @@ struct acl_expr *parse_acl_expr(const char **args, char **err, struct arg_list *
                        expr->pat.parse = pat_parse_fcts[PAT_MATCH_IP];
                        expr->pat.index = pat_index_fcts[PAT_MATCH_IP];
                        expr->pat.match = pat_match_fcts[PAT_MATCH_IP];
-                       expr->pat.delete = pat_delete_fcts[PAT_MATCH_IP];
                        expr->pat.prune = pat_prune_fcts[PAT_MATCH_IP];
                        expr->pat.expect_type = pat_match_types[PAT_MATCH_IP];
                        break;
@@ -380,7 +376,6 @@ struct acl_expr *parse_acl_expr(const char **args, char **err, struct arg_list *
                        expr->pat.parse = pat_parse_fcts[PAT_MATCH_STR];
                        expr->pat.index = pat_index_fcts[PAT_MATCH_STR];
                        expr->pat.match = pat_match_fcts[PAT_MATCH_STR];
-                       expr->pat.delete = pat_delete_fcts[PAT_MATCH_STR];
                        expr->pat.prune = pat_prune_fcts[PAT_MATCH_STR];
                        expr->pat.expect_type = pat_match_types[PAT_MATCH_STR];
                        break;
@@ -465,7 +460,6 @@ struct acl_expr *parse_acl_expr(const char **args, char **err, struct arg_list *
                        expr->pat.parse = pat_parse_fcts[idx];
                        expr->pat.index = pat_index_fcts[idx];
                        expr->pat.match = pat_match_fcts[idx];
-                       expr->pat.delete = pat_delete_fcts[idx];
                        expr->pat.prune = pat_prune_fcts[idx];
                        expr->pat.expect_type = pat_match_types[idx];
                        args++;
index 8cfbbe51a1381705ced603829eb376b329184429..ee022e29ba6c775ce9a74950ab962e9953ac5ecd 100644 (file)
--- a/src/map.c
+++ b/src/map.c
@@ -120,7 +120,6 @@ int sample_load_map(struct arg *arg, struct sample_conv *conv,
        desc->pat.match = pat_match_fcts[(long)conv->private];
        desc->pat.parse = pat_parse_fcts[(long)conv->private];
        desc->pat.index = pat_index_fcts[(long)conv->private];
-       desc->pat.delete = pat_delete_fcts[(long)conv->private];
        desc->pat.prune = pat_prune_fcts[(long)conv->private];
        desc->pat.expect_type = pat_match_types[(long)conv->private];
 
index 89a5c4844b20ba3c1f37d15a138a8aab9dce32ce..6659364c789933eb9a8b8d398525015a52f3f2a4 100644 (file)
@@ -79,23 +79,6 @@ int (*pat_index_fcts[PAT_MATCH_NUM])(struct pattern_expr *, struct pattern *, ch
        [PAT_MATCH_REGM]  = pat_idx_list_regm,
 };
 
-void (*pat_delete_fcts[PAT_MATCH_NUM])(struct pat_ref *, struct pat_ref_elt *) = {
-       [PAT_MATCH_FOUND] = pat_delete_gen,
-       [PAT_MATCH_BOOL]  = pat_delete_gen,
-       [PAT_MATCH_INT]   = pat_delete_gen,
-       [PAT_MATCH_IP]    = pat_delete_gen,
-       [PAT_MATCH_BIN]   = pat_delete_gen,
-       [PAT_MATCH_LEN]   = pat_delete_gen,
-       [PAT_MATCH_STR]   = pat_delete_gen,
-       [PAT_MATCH_BEG]   = pat_delete_gen,
-       [PAT_MATCH_SUB]   = pat_delete_gen,
-       [PAT_MATCH_DIR]   = pat_delete_gen,
-       [PAT_MATCH_DOM]   = pat_delete_gen,
-       [PAT_MATCH_END]   = pat_delete_gen,
-       [PAT_MATCH_REG]   = pat_delete_gen,
-       [PAT_MATCH_REGM]  = pat_delete_gen,
-};
-
 void (*pat_prune_fcts[PAT_MATCH_NUM])(struct pattern_expr *) = {
        [PAT_MATCH_FOUND] = pat_prune_gen,
        [PAT_MATCH_BOOL]  = pat_prune_gen,