commit 5f29ce0: [Fix] Another try to fix references safety

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Aug 31 12:14:04 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-08-31 13:12:00 +0100
URL: https://github.com/rspamd/rspamd/commit/5f29ce0df5ced4301c686ffca154e7f7f2db14ab (HEAD -> master)

[Fix] Another try to fix references safety
Issue: #3871

---
 src/libserver/css/css_parser.cxx    | 12 ++++++------
 src/libserver/css/css_tokeniser.hxx |  4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/libserver/css/css_parser.cxx b/src/libserver/css/css_parser.cxx
index ef3d6f666..d7d56f3e5 100644
--- a/src/libserver/css/css_parser.cxx
+++ b/src/libserver/css/css_parser.cxx
@@ -319,7 +319,7 @@ auto css_parser::simple_block_consumer(std::unique_ptr<css_consumed_block> &top,
 			/* Ignore whitespaces */
 			break;
 		default:
-			tokeniser->pushback_token(std::move(next_token));
+			tokeniser->pushback_token(next_token);
 			ret = component_value_consumer(consume_current ? top : block);
 			break;
 		}
@@ -379,7 +379,7 @@ auto css_parser::qualified_rule_consumer(std::unique_ptr<css_consumed_block> &to
 			/* Ignore whitespaces */
 			break;
 		default:
-			tokeniser->pushback_token(std::move(next_token));
+			tokeniser->pushback_token(next_token);
 			ret = component_value_consumer(block);
 			break;
 		};
@@ -442,7 +442,7 @@ auto css_parser::at_rule_consumer(std::unique_ptr<css_consumed_block> &top) -> b
 			want_more = false;
 			break;
 		default:
-			tokeniser->pushback_token(std::move(next_token));
+			tokeniser->pushback_token(next_token);
 			ret = component_value_consumer(block);
 			break;
 		};
@@ -559,11 +559,11 @@ css_parser::consume_css_blocks(const std::string_view &sv) -> std::unique_ptr<cs
 			eof = true;
 			break;
 		case css_parser_token::token_type::at_keyword_token:
-			tokeniser->pushback_token(std::move(next_token));
+			tokeniser->pushback_token(next_token);
 			ret = at_rule_consumer(consumed_blocks);
 			break;
 		default:
-			tokeniser->pushback_token(std::move(next_token));
+			tokeniser->pushback_token(next_token);
 			ret = qualified_rule_consumer(consumed_blocks);
 			break;
 		}
@@ -595,7 +595,7 @@ css_parser::consume_css_rule(const std::string_view &sv) -> std::unique_ptr<css_
 			/* Ignore whitespaces */
 			break;
 		default:
-			tokeniser->pushback_token(std::move(next_token));
+			tokeniser->pushback_token(next_token);
 			ret = component_value_consumer(rule_block);
 			break;
 		}
diff --git a/src/libserver/css/css_tokeniser.hxx b/src/libserver/css/css_tokeniser.hxx
index 36ab33d8a..ac38df463 100644
--- a/src/libserver/css/css_tokeniser.hxx
+++ b/src/libserver/css/css_tokeniser.hxx
@@ -186,8 +186,8 @@ public:
 
 	auto next_token(void) -> struct css_parser_token;
 	auto get_offset(void) const { return offset; }
-	auto pushback_token(struct css_parser_token &&t) const -> void {
-		backlog.push_back(std::forward<css_parser_token>(t));
+	auto pushback_token(const struct css_parser_token &t) const -> void {
+		backlog.push_back(t);
 	}
 private:
 	std::string_view input;


More information about the Commits mailing list