From 787ca7f19b18aa80073b8d5107e70761a7385af1 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 29 Apr 2018 17:26:49 +1000 Subject: [PATCH] Regex: small code style tweak --- src/regex_impl.hh | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/regex_impl.hh b/src/regex_impl.hh index 379e5539..14d5bbfd 100644 --- a/src/regex_impl.hh +++ b/src/regex_impl.hh @@ -202,9 +202,8 @@ public: }; EffectiveIt start{config.begin}; - const auto& start_desc = direction == MatchDirection::Forward ? m_program.forward_start_desc - : m_program.backward_start_desc; - if (start_desc) + if (const auto& start_desc = direction == MatchDirection::Forward ? + m_program.forward_start_desc : m_program.backward_start_desc) { if (search) { @@ -213,8 +212,7 @@ public: return false; } else if (start != config.end and - not start_desc->map[*start < CompiledRegex::StartDesc::count ? - *start : CompiledRegex::StartDesc::other]) + not start_desc->map[*start < StartDesc::count ? *start : StartDesc::other]) return false; } @@ -281,6 +279,7 @@ private: int16_t saves; }; + using StartDesc = CompiledRegex::StartDesc; using Utf8It = utf8::iterator; using EffectiveIt = std::conditional_t>; @@ -507,12 +506,11 @@ private: } } - void to_next_start(EffectiveIt& start, const EffectiveIt& end, - const CompiledRegex::StartDesc& start_desc) + void to_next_start(EffectiveIt& start, const EffectiveIt& end, const StartDesc& start_desc) { Codepoint cp; while (start != end and (cp = *start) >= 0 and - not start_desc.map[cp < CompiledRegex::StartDesc::count ? cp : CompiledRegex::StartDesc::other]) + not start_desc.map[cp < StartDesc::count ? cp : StartDesc::other]) ++start; }