From: Emeric Brun Date: Thu, 15 Jun 2017 09:53:49 +0000 (+0200) Subject: MINOR: threads/regex: Change Regex trash buffer into a thread local variable X-Git-Tag: v1.8-rc1~139 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=272e252e61cbb34959d111ed067caf2cf0d11f4a;p=thirdparty%2Fhaproxy.git MINOR: threads/regex: Change Regex trash buffer into a thread local variable --- diff --git a/include/common/regex.h b/include/common/regex.h index 2f171b3ba3..c3b921b3f1 100644 --- a/include/common/regex.h +++ b/include/common/regex.h @@ -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 diff --git a/src/regex.c b/src/regex.c index 38d7132b3d..993a37a431 100644 --- a/src/regex.c +++ b/src/regex.c @@ -22,7 +22,7 @@ #include /* 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) {