MINOR: threads/regex: Change Regex trash buffer into a thread local variable
authorEmeric Brun <ebrun@haproxy.com>
Thu, 15 Jun 2017 09:53:49 +0000 (11:53 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 31 Oct 2017 12:58:31 +0000 (13:58 +0100)
include/common/regex.h
src/regex.c

index 2f171b3..c3b921b 100644 (file)
@@ -76,7 +76,7 @@ struct hdr_exp {
     void *cond;                                /* a possible condition or NULL */
 };
 
-extern regmatch_t pmatch[MAX_MATCH];
+extern THREAD_LOCAL regmatch_t pmatch[MAX_MATCH];
 
 /* "str" is the string that contain the regex to compile.
  * "regex" is preallocated memory. After the execution of this function, this
index 38d7132..993a37a 100644 (file)
@@ -22,7 +22,7 @@
 #include <proto/log.h>
 
 /* regex trash buffer used by various regex tests */
-regmatch_t pmatch[MAX_MATCH];  /* rm_so, rm_eo for regular expressions */
+THREAD_LOCAL regmatch_t pmatch[MAX_MATCH];  /* rm_so, rm_eo for regular expressions */
 
 int exp_replace(char *dst, unsigned int dst_size, char *src, const char *str, const regmatch_t *matches)
 {