From: Vsevolod Stakhov Date: Tue, 6 Jul 2021 12:54:55 +0000 (+0100) Subject: [Minor] Use a more generic lc method X-Git-Tag: 3.0~208 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6c18aea18275672cc86389ed79f49f5de3823fc0;p=rspamd.git [Minor] Use a more generic lc method --- 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(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(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));