regex: properly call pcre2_jit_compile

This commit is contained in:
jgmdev 2022-12-28 19:40:20 -04:00
parent 74349f8e56
commit 79908baed6
1 changed files with 2 additions and 3 deletions

View File

@ -46,9 +46,7 @@ static pcre2_code* regex_get_pattern(lua_State *L, bool* should_free) {
return NULL; return NULL;
} }
if (pcre2_config(PCRE2_CONFIG_JIT, NULL) == 1) {
pcre2_jit_compile(re, PCRE2_JIT_COMPLETE); pcre2_jit_compile(re, PCRE2_JIT_COMPLETE);
}
*should_free = true; *should_free = true;
} }
@ -159,6 +157,7 @@ static int f_pcre_compile(lua_State *L) {
NULL NULL
); );
if (re) { if (re) {
pcre2_jit_compile(re, PCRE2_JIT_COMPLETE);
lua_newtable(L); lua_newtable(L);
lua_pushlightuserdata(L, re); lua_pushlightuserdata(L, re);
lua_rawseti(L, -2, 1); lua_rawseti(L, -2, 1);