diff --git a/src/regex/pcre2.cr b/src/regex/pcre2.cr index 973e1967499d..de625d3676d3 100644 --- a/src/regex/pcre2.cr +++ b/src/regex/pcre2.cr @@ -140,12 +140,6 @@ module Regex::PCRE2 flag end - def finalize - {% unless flag?(:interpreted) %} - LibPCRE2.code_free @re - {% end %} - end - protected def self.error_impl(source) code = PCRE2.compile(source, LibPCRE2::UTF | LibPCRE2::DUPNAMES | LibPCRE2::UCP) do |error_message| return error_message @@ -256,6 +250,7 @@ module Regex::PCRE2 @match_data.consume_each do |match_data| LibPCRE2.match_data_free(match_data) end + LibPCRE2.code_free @re end private def match_data(str, byte_index, options) @@ -278,12 +273,6 @@ module Regex::PCRE2 match_data end - def self.config(what, type : T.class) : T forall T - value = uninitialized T - LibPCRE2.config(what, pointerof(value)) - value - end - module MatchData # :nodoc: def initialize(@regex : Regex, @code : LibPCRE2::Code*, @string : String, @pos : Int32, @ovector : LibC::SizeT*, @group_size : Int32)