From 52df3bc0c7934a78bab7172f75d7b5aee1bc17b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20M=C3=BCller?= Date: Sun, 13 Apr 2025 14:02:48 +0200 Subject: [PATCH] ``: Simplify matching of `_N_if` NFA nodes in leftmost-longest mode --- stl/inc/regex | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/stl/inc/regex b/stl/inc/regex index 1434e738cd9..81b9672327e 100644 --- a/stl/inc/regex +++ b/stl/inc/regex @@ -3190,8 +3190,6 @@ bool _Matcher<_BidIt, _Elem, _RxTraits, _It>::_Do_if(_Node_if* _Node) { // apply } // see if there is a longer match - _Tgt_state_t<_It> _Final = _Tgt_state; - auto _Final_len = _STD distance(_St._Cur, _Tgt_state._Cur); for (;;) { // process one branch of if _Node = _Node->_Child; if (!_Node) { @@ -3199,17 +3197,8 @@ bool _Matcher<_BidIt, _Elem, _RxTraits, _It>::_Do_if(_Node_if* _Node) { // apply } _Tgt_state = _St; - if (_Match_pat(_Node->_Next)) { // record match if it is longer - const auto _Len = _STD distance(_St._Cur, _Tgt_state._Cur); - if (_Final_len < _Len) { // memorize longest so far - _Final = _Tgt_state; - _Final_len = _Len; - } - } + (void) _Match_pat(_Node->_Next); } - - // set the input end to the longest match - _Tgt_state = _Final; return true; }