From a4c1860bfcf48c1fb7c555bcc95f1a591b115cc2 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Fri, 23 Apr 2021 20:50:27 +0200 Subject: [PATCH] LibRegex: Put to dbgln()s behind REGEX_DEBUG --- Userland/Libraries/LibRegex/RegexMatcher.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Userland/Libraries/LibRegex/RegexMatcher.cpp b/Userland/Libraries/LibRegex/RegexMatcher.cpp index 566ac74fd5d..568267bf16c 100644 --- a/Userland/Libraries/LibRegex/RegexMatcher.cpp +++ b/Userland/Libraries/LibRegex/RegexMatcher.cpp @@ -86,7 +86,7 @@ RegexResult Matcher::match(const Vector views, Optional if (input.regex_options.has_flag_set(AllFlags::Internal_Stateful)) { if (views.size() > 1 && input.start_offset > views.first().length()) { - dbgln("Started with start={}, goff={}, skip={}", input.start_offset, input.global_offset, lines_to_skip); + dbgln_if(REGEX_DEBUG, "Started with start={}, goff={}, skip={}", input.start_offset, input.global_offset, lines_to_skip); for (auto& view : views) { if (input.start_offset < view.length() + 1) break; @@ -94,7 +94,7 @@ RegexResult Matcher::match(const Vector views, Optional input.start_offset -= view.length() + 1; input.global_offset += view.length() + 1; } - dbgln("Ended with start={}, goff={}, skip={}", input.start_offset, input.global_offset, lines_to_skip); + dbgln_if(REGEX_DEBUG, "Ended with start={}, goff={}, skip={}", input.start_offset, input.global_offset, lines_to_skip); } } @@ -213,10 +213,8 @@ RegexResult Matcher::match(const Vector views, Optional continue; } - if constexpr (REGEX_DEBUG) { - dbgln("state.string_position={}, view_index={}", state.string_position, view_index); - dbgln("[match] Found a match (length={}): '{}'", state.string_position - view_index, input.view.substring_view(view_index, state.string_position - view_index)); - } + dbgln_if(REGEX_DEBUG, "state.string_position={}, view_index={}", state.string_position, view_index); + dbgln_if(REGEX_DEBUG, "[match] Found a match (length={}): '{}'", state.string_position - view_index, input.view.substring_view(view_index, state.string_position - view_index)); ++match_count;