commit 6c18aea: [Minor] Use a more generic lc method

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Jul 6 13:49:04 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-07-06 13:54:55 +0100
URL: https://github.com/rspamd/rspamd/commit/6c18aea18275672cc86389ed79f49f5de3823fc0

[Minor] Use a more generic lc method

---
 src/libserver/css/css_parser.cxx | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/src/libserver/css/css_parser.cxx b/src/libserver/css/css_parser.cxx
index bcff14f75..1ab46a4ec 100644
--- a/src/libserver/css/css_parser.cxx
+++ b/src/libserver/css/css_parser.cxx
@@ -797,15 +797,9 @@ parse_css_declaration(rspamd_mempool_t *pool, const std::string_view &st)
 		processed_input = rspamd::css::unescape_css(pool, st);
 	}
 	else {
-		/* Lowercase inplace */
-		auto *nspace = reinterpret_cast<char *>(rspamd_mempool_alloc(pool, st.length()));
-		auto *p = nspace;
-
-		for (const auto c : st) {
-			*p++ = g_ascii_tolower(c);
-		}
-
-		processed_input = std::string_view{nspace, (std::size_t)(p - nspace)};
+		auto *nspace = reinterpret_cast<char *>(rspamd_mempool_alloc(pool, st.size()));
+		auto nlen = rspamd_str_copy_lc(st.data(), nspace, st.size());
+		processed_input = std::string_view{nspace, nlen};
 	}
 	auto &&res = process_declaration_tokens(pool,
 			get_rules_parser_functor(pool, processed_input));


More information about the Commits mailing list