#include <haproxy/sample-t.h>
/* pattern management function arrays */
-extern char *pat_match_names[PAT_MATCH_NUM];
-extern int pat_match_types[PAT_MATCH_NUM];
+extern const char *const pat_match_names[PAT_MATCH_NUM];
+extern int const 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_prune_fcts[PAT_MATCH_NUM])(struct pattern_expr *);
-extern struct pattern *(*pat_match_fcts[PAT_MATCH_NUM])(struct sample *, struct pattern_expr *, int);
+extern int (*const pat_parse_fcts[PAT_MATCH_NUM])(const char *, struct pattern *, int, char **);
+extern int (*const pat_index_fcts[PAT_MATCH_NUM])(struct pattern_expr *, struct pattern *, char **);
+extern void (*const pat_prune_fcts[PAT_MATCH_NUM])(struct pattern_expr *);
+extern struct pattern *(*const pat_match_fcts[PAT_MATCH_NUM])(struct sample *, struct pattern_expr *, int);
/* This is the root of the list of all pattern_ref avalaibles. */
extern struct list pattern_reference;
#include <haproxy/tools.h>
-char *pat_match_names[PAT_MATCH_NUM] = {
+const char *const pat_match_names[PAT_MATCH_NUM] = {
[PAT_MATCH_FOUND] = "found",
[PAT_MATCH_BOOL] = "bool",
[PAT_MATCH_INT] = "int",
[PAT_MATCH_REGM] = "regm",
};
-int (*pat_parse_fcts[PAT_MATCH_NUM])(const char *, struct pattern *, int, char **) = {
+int (*const pat_parse_fcts[PAT_MATCH_NUM])(const char *, struct pattern *, int, char **) = {
[PAT_MATCH_FOUND] = pat_parse_nothing,
[PAT_MATCH_BOOL] = pat_parse_nothing,
[PAT_MATCH_INT] = pat_parse_int,
[PAT_MATCH_REGM] = pat_parse_reg,
};
-int (*pat_index_fcts[PAT_MATCH_NUM])(struct pattern_expr *, struct pattern *, char **) = {
+int (*const pat_index_fcts[PAT_MATCH_NUM])(struct pattern_expr *, struct pattern *, char **) = {
[PAT_MATCH_FOUND] = pat_idx_list_val,
[PAT_MATCH_BOOL] = pat_idx_list_val,
[PAT_MATCH_INT] = pat_idx_list_val,
[PAT_MATCH_REGM] = pat_idx_list_regm,
};
-void (*pat_prune_fcts[PAT_MATCH_NUM])(struct pattern_expr *) = {
+void (*const pat_prune_fcts[PAT_MATCH_NUM])(struct pattern_expr *) = {
[PAT_MATCH_FOUND] = pat_prune_gen,
[PAT_MATCH_BOOL] = pat_prune_gen,
[PAT_MATCH_INT] = pat_prune_gen,
[PAT_MATCH_REGM] = pat_prune_gen,
};
-struct pattern *(*pat_match_fcts[PAT_MATCH_NUM])(struct sample *, struct pattern_expr *, int) = {
+struct pattern *(*const pat_match_fcts[PAT_MATCH_NUM])(struct sample *, struct pattern_expr *, int) = {
[PAT_MATCH_FOUND] = NULL,
[PAT_MATCH_BOOL] = pat_match_nothing,
[PAT_MATCH_INT] = pat_match_int,
};
/* Just used for checking configuration compatibility */
-int pat_match_types[PAT_MATCH_NUM] = {
+int const pat_match_types[PAT_MATCH_NUM] = {
[PAT_MATCH_FOUND] = SMP_T_SINT,
[PAT_MATCH_BOOL] = SMP_T_SINT,
[PAT_MATCH_INT] = SMP_T_SINT,