From cb09dff9f16261661e23d79639ec1ad2e140e854 Mon Sep 17 00:00:00 2001 From: Roberto Alsina Date: Thu, 15 Aug 2024 21:35:06 -0300 Subject: [PATCH] Minor cleanup --- src/bytes_regex.cr | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/bytes_regex.cr b/src/bytes_regex.cr index 6f6c8d9..1345ad3 100644 --- a/src/bytes_regex.cr +++ b/src/bytes_regex.cr @@ -3,7 +3,7 @@ module BytesRegex class Regex def initialize(pattern : String, multiline = false, dotall = false, ignorecase = false, anchored = false) - flags = LibPCRE2::UTF | LibPCRE2::DUPNAMES | LibPCRE2::UCP | LibPCRE2::NO_UTF_CHECK + flags = LibPCRE2::UTF | LibPCRE2::UCP | LibPCRE2::NO_UTF_CHECK flags |= LibPCRE2::MULTILINE if multiline flags |= LibPCRE2::DOTALL if dotall flags |= LibPCRE2::CASELESS if ignorecase @@ -40,9 +40,7 @@ module BytesRegex LibPCRE2::NO_UTF_CHECK, @match_data, nil) - if rc < 0 - # No match, do nothing - else + if rc > 0 ovector = LibPCRE2.get_ovector_pointer(@match_data) (0...rc).each do |i| m_start = ovector[2 * i]