Skip to content

Commit

Permalink
Revert "Disable JIT invocation, distro compiled ones don't have these"
Browse files Browse the repository at this point in the history
This reverts commit d35b1ef.
  • Loading branch information
jerinphilip committed Dec 20, 2023
1 parent c873c6a commit 978a13f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 7 additions & 1 deletion slimt/Regex.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,20 @@

namespace slimt {

Regex::Regex(const std::string& pattern, uint32_t options)
Regex::Regex(const std::string& pattern, uint32_t options, uint32_t jit_options)
: re_(pcre2_compile(PCRE2_SPTR(pattern.c_str()), /* the pattern */
PCRE2_ZERO_TERMINATED, /* pattern is zero-terminated */
options, /* options */
&error_number_, /* for error number */
&error_offset_, /* for error offset */
nullptr)) /* use default compile context */
{
uint32_t have_jit;
pcre2_config(PCRE2_CONFIG_JIT, &have_jit);
if (have_jit) {
pcre2_jit_compile(re_, jit_options);
}

pattern_ = pattern;
}

Expand Down
5 changes: 3 additions & 2 deletions slimt/Regex.hh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ class Match;
class Regex {
public:
Regex(const std::string& pattern, // pattern to be compiled
uint32_t options // pcre2 options for regex compilation
);
uint32_t options, // pcre2 options for regex compilation
uint32_t jit_options =
PCRE2_JIT_COMPLETE); // options for jit compilation
~Regex();

int find(std::string_view subj, // the string (view) agains we are matching
Expand Down

0 comments on commit 978a13f

Please sign in to comment.