CLEANUP: pattern: remove pat_delete_fcts[] and pattern_head->delete()

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.
This commit is contained in:
Willy Tarreau 2020-11-02 20:20:47 +01:00
parent b35aa9b256
commit a98b2882ac
5 changed files with 0 additions and 26 deletions

View 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_*) */

View 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);

View File

@ -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++;

View File

@ -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];

View 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,