Skip to content

Commit

Permalink
fixup! PCRE2: use System::ThreadLocal for the JITStack and MatchData
Browse files Browse the repository at this point in the history
  • Loading branch information
ysbaddaden committed Jan 31, 2025
1 parent 84ba4f7 commit 369a777
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/regex/pcre2.cr
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,10 @@ module Regex::PCRE2
private def match_impl(str, byte_index, options)
match_data = match_data(str, byte_index, options) || return

ovector_count = LibPCRE2.get_ovector_count(match_data)
# we reuse the same matchdata allocation, so we must "reimplement" the
# behavior of pcre2_match_data_create_from_pattern (get_ovector_count always
# returns 65535, aka the maximum):
ovector_count = capture_count_impl &+ 1
ovector = Slice.new(LibPCRE2.get_ovector_pointer(match_data), ovector_count &* 2)

# We need to dup the ovector because `match_data` is re-used for subsequent
Expand Down

0 comments on commit 369a777

Please sign in to comment.