summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibRegex
diff options
context:
space:
mode:
authorHendiadyoin1 <leon2002.la@gmail.com>2021-12-21 17:38:51 +0100
committerBrian Gianforcaro <b.gianfo@gmail.com>2021-12-21 18:17:28 -0800
commitb674de69578bf8d4f3043777fa0ef3262e5a40b3 (patch)
tree7c76089bb5c0efc71f860468317e0668fc01fd27 /Userland/Libraries/LibRegex
parent1fdd1915c27fdfa01b55136c1eb1ecd90e88fb8b (diff)
downloadserenity-b674de69578bf8d4f3043777fa0ef3262e5a40b3.zip
LibRegex: Add some implied auto qualifiers
Diffstat (limited to 'Userland/Libraries/LibRegex')
-rw-r--r--Userland/Libraries/LibRegex/C/Regex.cpp8
-rw-r--r--Userland/Libraries/LibRegex/RegexByteCode.cpp2
-rw-r--r--Userland/Libraries/LibRegex/RegexMatcher.cpp6
-rw-r--r--Userland/Libraries/LibRegex/RegexOptimizer.cpp4
4 files changed, 10 insertions, 10 deletions
diff --git a/Userland/Libraries/LibRegex/C/Regex.cpp b/Userland/Libraries/LibRegex/C/Regex.cpp
index 35c40e9396..f3c7258de6 100644
--- a/Userland/Libraries/LibRegex/C/Regex.cpp
+++ b/Userland/Libraries/LibRegex/C/Regex.cpp
@@ -52,7 +52,7 @@ int regcomp(regex_t* reg, const char* pattern, int cflags)
// This could've been prevented if libc provided a reginit() or similar, but it does not.
reg->__data = new internal_regex_t { 0, 0, {}, 0, ReError::REG_NOERR, {} };
- auto preg = impl_from(reg);
+ auto* preg = impl_from(reg);
bool is_extended = cflags & REG_EXTENDED;
preg->cflags = cflags;
@@ -82,7 +82,7 @@ int regcomp(regex_t* reg, const char* pattern, int cflags)
int regexec(const regex_t* reg, const char* string, size_t nmatch, regmatch_t pmatch[], int eflags)
{
- auto preg = impl_from(reg);
+ auto const* preg = impl_from(reg);
if (!preg->re.has_value() || preg->re_pat_err) {
if (preg->re_pat_err)
@@ -213,7 +213,7 @@ inline static String get_error(ReError errcode)
size_t regerror(int errcode, const regex_t* reg, char* errbuf, size_t errbuf_size)
{
String error;
- auto preg = impl_from(reg);
+ auto const* preg = impl_from(reg);
if (!preg)
error = get_error((ReError)errcode);
@@ -231,7 +231,7 @@ size_t regerror(int errcode, const regex_t* reg, char* errbuf, size_t errbuf_siz
void regfree(regex_t* reg)
{
- auto preg = impl_from(reg);
+ auto* preg = impl_from(reg);
if (preg) {
delete preg;
reg->__data = nullptr;
diff --git a/Userland/Libraries/LibRegex/RegexByteCode.cpp b/Userland/Libraries/LibRegex/RegexByteCode.cpp
index 9a0c9f3818..75095d98a7 100644
--- a/Userland/Libraries/LibRegex/RegexByteCode.cpp
+++ b/Userland/Libraries/LibRegex/RegexByteCode.cpp
@@ -502,7 +502,7 @@ ALWAYS_INLINE ExecutionResult OpCode_Compare::execute(MatchInput const& input, M
auto ch = input.view.substring_view(state.string_position, 1)[0];
- auto matching_range = binary_search(range_data, ch, nullptr, [insensitive = input.regex_options & AllFlags::Insensitive](auto needle, CharRange range) {
+ auto const* matching_range = binary_search(range_data, ch, nullptr, [insensitive = input.regex_options & AllFlags::Insensitive](auto needle, CharRange range) {
auto from = range.from;
auto to = range.to;
if (insensitive) {
diff --git a/Userland/Libraries/LibRegex/RegexMatcher.cpp b/Userland/Libraries/LibRegex/RegexMatcher.cpp
index f9b53c9325..bd40c723ee 100644
--- a/Userland/Libraries/LibRegex/RegexMatcher.cpp
+++ b/Userland/Libraries/LibRegex/RegexMatcher.cpp
@@ -130,13 +130,13 @@ RegexResult Matcher<Parser>::match(Vector<RegexStringView> const& views, Optiona
size_t lines_to_skip = 0;
bool unicode = input.regex_options.has_flag_set(AllFlags::Unicode);
- for (auto& view : views)
+ for (auto const& view : views)
const_cast<RegexStringView&>(view).set_unicode(unicode);
if (input.regex_options.has_flag_set(AllFlags::Internal_Stateful)) {
if (views.size() > 1 && input.start_offset > views.first().length()) {
dbgln_if(REGEX_DEBUG, "Started with start={}, goff={}, skip={}", input.start_offset, input.global_offset, lines_to_skip);
- for (auto& view : views) {
+ for (auto const& view : views) {
if (input.start_offset < view.length() + 1)
break;
++lines_to_skip;
@@ -181,7 +181,7 @@ RegexResult Matcher<Parser>::match(Vector<RegexStringView> const& views, Optiona
if (input.regex_options.has_flag_set(AllFlags::Internal_Stateful))
continue_search = false;
- for (auto& view : views) {
+ for (auto const& view : views) {
if (lines_to_skip != 0) {
++input.line;
--lines_to_skip;
diff --git a/Userland/Libraries/LibRegex/RegexOptimizer.cpp b/Userland/Libraries/LibRegex/RegexOptimizer.cpp
index 1445ced1e5..ea2288ded9 100644
--- a/Userland/Libraries/LibRegex/RegexOptimizer.cpp
+++ b/Userland/Libraries/LibRegex/RegexOptimizer.cpp
@@ -213,7 +213,7 @@ void Regex<Parser>::attempt_rewrite_loops_as_atomic_groups(BasicBlockList const&
if constexpr (REGEX_DEBUG) {
RegexDebug dbg;
dbg.print_bytecode(*this);
- for (auto& block : basic_blocks)
+ for (auto const& block : basic_blocks)
dbgln("block from {} to {}", block.start, block.end);
}
@@ -264,7 +264,7 @@ void Regex<Parser>::attempt_rewrite_loops_as_atomic_groups(BasicBlockList const&
auto is_an_eligible_jump = [](OpCode const& opcode, size_t ip, size_t block_start, AlternateForm alternate_form) {
switch (opcode.opcode_id()) {
case OpCodeId::JumpNonEmpty: {
- auto& op = static_cast<OpCode_JumpNonEmpty const&>(opcode);
+ auto const& op = static_cast<OpCode_JumpNonEmpty const&>(opcode);
auto form = op.form();
if (form != OpCodeId::Jump && alternate_form == AlternateForm::DirectLoopWithHeader)
return false;