| 268 | } |
| 269 | |
| 270 | static int pcre2_jit_functional(void) |
| 271 | { |
| 272 | static int jit_working = -1; |
| 273 | pcre2_code *code; |
| 274 | size_t off; |
| 275 | int err; |
| 276 | |
| 277 | if (jit_working != -1) |
| 278 | return jit_working; |
| 279 | |
| 280 | /* |
| 281 | * Try to JIT compile a simple pattern to probe if the JIT is |
| 282 | * working in general. It might fail for systems where creating |
| 283 | * memory mappings for runtime code generation is restricted. |
| 284 | */ |
| 285 | code = pcre2_compile((PCRE2_SPTR)".", 1, 0, &err, &off, NULL); |
| 286 | if (!code) |
| 287 | return 0; |
| 288 | |
| 289 | jit_working = pcre2_jit_compile(code, PCRE2_JIT_COMPLETE) == 0; |
| 290 | pcre2_code_free(code); |
| 291 | |
| 292 | return jit_working; |
| 293 | } |
| 294 | |
| 295 | static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt) |
| 296 | { |
no outgoing calls
no test coverage detected