diff --git a/src/log_surgeon/LALR1Parser.tpp b/src/log_surgeon/LALR1Parser.tpp index 02f38cd8..f356bd6f 100644 --- a/src/log_surgeon/LALR1Parser.tpp +++ b/src/log_surgeon/LALR1Parser.tpp @@ -88,18 +88,17 @@ auto LALR1Parser::add_token_chain( std::string const& chain ) -> void { assert(chain.size() > 1); - std::unique_ptr> first_char_rule + auto first_char_rule = std::make_unique>(chain[0]); - std::unique_ptr> second_char_rule + auto second_char_rule = std::make_unique>(chain[1]); - std::unique_ptr> rule_chain - = std::make_unique>( - std::move(first_char_rule), - std::move(second_char_rule) - ); + auto rule_chain = std::make_unique>( + std::move(first_char_rule), + std::move(second_char_rule) + ); for (uint32_t i = 2; i < chain.size(); i++) { - char next_char = chain[i]; - std::unique_ptr> next_char_rule + auto next_char = chain[i]; + auto next_char_rule = std::make_unique>(next_char); rule_chain = std::make_unique>( std::move(rule_chain), diff --git a/src/log_surgeon/Lexer.tpp b/src/log_surgeon/Lexer.tpp index b1ff9f76..04c2f50d 100644 --- a/src/log_surgeon/Lexer.tpp +++ b/src/log_surgeon/Lexer.tpp @@ -65,9 +65,9 @@ auto Lexer::scan(ParserInputBuffer& input_buffer, To m_type_ids = nullptr; } while (true) { - uint32_t prev_byte_buf_pos = input_buffer.storage().pos(); - unsigned char next_char{utf8::cCharErr}; - if (ErrorCode err = input_buffer.get_next_character(next_char); ErrorCode::Success != err) { + auto prev_byte_buf_pos = input_buffer.storage().pos(); + auto next_char{utf8::cCharErr}; + if (auto const err = input_buffer.get_next_character(next_char); ErrorCode::Success != err) { m_asked_for_more_data = true; m_prev_state = state; return err; @@ -80,7 +80,7 @@ auto Lexer::scan(ParserInputBuffer& input_buffer, To m_match_pos = prev_byte_buf_pos; m_match_line = m_line; } - DfaStateType* next = state->next(next_char); + auto* next = state->next(next_char); if (next_char == '\n') { m_line++; if (m_has_delimiters && !m_match) { diff --git a/src/log_surgeon/LogEvent.cpp b/src/log_surgeon/LogEvent.cpp index 709e62ce..8a3deead 100644 --- a/src/log_surgeon/LogEvent.cpp +++ b/src/log_surgeon/LogEvent.cpp @@ -42,7 +42,7 @@ auto LogEventView::reset() -> void { start = 1; } for (uint32_t i = start; i < m_log_output_buffer->pos(); i++) { - Token& token = m_log_output_buffer->get_mutable_token(i); + auto& token = m_log_output_buffer->get_mutable_token(i); raw_log += token.to_string_view(); } return raw_log; @@ -51,7 +51,7 @@ auto LogEventView::reset() -> void { auto LogEventView::get_logtype() const -> std::string { std::string logtype; for (uint32_t i = 1; i < m_log_output_buffer->pos(); i++) { - Token& token = m_log_output_buffer->get_mutable_token(i); + auto& token = m_log_output_buffer->get_mutable_token(i); if (token.m_type_ids_ptr->at(0) == (uint32_t)SymbolId::TokenUncaughtString) { logtype += token.to_string_view(); } else { diff --git a/src/log_surgeon/Schema.cpp b/src/log_surgeon/Schema.cpp index e2008b18..dd4b0869 100644 --- a/src/log_surgeon/Schema.cpp +++ b/src/log_surgeon/Schema.cpp @@ -11,7 +11,7 @@ Schema::Schema(std::string const& schema_file_path) : m_schema_ast{SchemaParser::try_schema_file(schema_file_path)} {} auto Schema::add_variable(std::string_view const var_schema, int const priority) const -> void { - std::unique_ptr const schema_ast = SchemaParser::try_schema_string(var_schema); + auto const schema_ast = SchemaParser::try_schema_string(var_schema); m_schema_ast->add_schema_var(std::move(schema_ast->m_schema_vars[0]), priority); } } // namespace log_surgeon