CLEANUP: pattern: make all pattern tables read-only

Interestingly, all arrays used to declare patterns were read-write while
only hard-coded. Let's mark them const so that they move from data to
rodata and don't risk to experience false sharing.
This commit is contained in:
Willy Tarreau
2021-04-10 17:44:27 +02:00
parent 9dee2150f6
commit 9057a0026e
2 changed files with 12 additions and 12 deletions

View File

@@ -29,13 +29,13 @@
#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;