diff options
Diffstat (limited to 'boost/beast/core/string.hpp')
-rw-r--r-- | boost/beast/core/string.hpp | 51 |
1 files changed, 14 insertions, 37 deletions
diff --git a/boost/beast/core/string.hpp b/boost/beast/core/string.hpp index f262b565da..27bfa57165 100644 --- a/boost/beast/core/string.hpp +++ b/boost/beast/core/string.hpp @@ -12,34 +12,12 @@ #include <boost/beast/core/detail/config.hpp> #include <boost/version.hpp> -#ifndef BOOST_BEAST_NO_BOOST_STRING_VIEW -# if BOOST_VERSION >= 106400 -# define BOOST_BEAST_NO_BOOST_STRING_VIEW 0 -# else -# define BOOST_BEAST_NO_BOOST_STRING_VIEW 1 -# endif -#endif - -#if BOOST_BEAST_NO_BOOST_STRING_VIEW -#include <boost/utility/string_ref.hpp> -#else #include <boost/utility/string_view.hpp> -#endif - #include <algorithm> namespace boost { namespace beast { -#if BOOST_BEAST_NO_BOOST_STRING_VIEW -/// The type of string view used by the library -using string_view = boost::string_ref; - -/// The type of basic string view used by the library -template<class CharT, class Traits> -using basic_string_view = - boost::basic_string_ref<CharT, Traits>; -#else /// The type of string view used by the library using string_view = boost::string_view; @@ -47,7 +25,6 @@ using string_view = boost::string_view; template<class CharT, class Traits> using basic_string_view = boost::basic_string_view<CharT, Traits>; -#endif namespace detail { @@ -55,9 +32,8 @@ inline char ascii_tolower(char c) { - if(c >= 'A' && c <= 'Z') - c += 'a' - 'A'; - return c; + return ((static_cast<unsigned>(c) - 65U) < 26) ? + c + 'a' - 'A' : c; } template<class = void> @@ -77,17 +53,18 @@ iequals( a = *p1++; b = *p2++; if(a != b) - goto slow; - } - return true; - - while(n--) - { - slow: - if(ascii_tolower(a) != ascii_tolower(b)) - return false; - a = *p1++; - b = *p2++; + { + // slow loop + do + { + if(ascii_tolower(a) != ascii_tolower(b)) + return false; + a = *p1++; + b = *p2++; + } + while(n--); + return true; + } } return true; } |