Make PCRE2 substitution buffer thread-local
ober
d7ae58888bfcafa19fb25b129ad5d33c195623f1
--- a/jerboa_pcre2_shim.c +++ b/jerboa_pcre2_shim.c @@ -105,10 +105,10 @@ size_t jerboa_pcre2_get_startchar(pcre2_match_data_8* md) } /* ------------------------------------------------------------------- - * Substitute — static buffer, not thread-safe; caller must serialize + * Substitute — result buffer is thread-local. * ------------------------------------------------------------------- */ -static char* _ffi_subst_buf = NULL; -static size_t _ffi_subst_len = 0; +static __thread char* _ffi_subst_buf = NULL; +static __thread size_t _ffi_subst_len = 0; int jerboa_pcre2_do_substitute( const pcre2_code_8* code,