mirror of
https://github.com/boostorg/beast.git
synced 2025-07-31 21:34:46 +02:00
Fix static_string uninitialized warning
This commit is contained in:
@@ -7,6 +7,7 @@ Version 191:
|
||||
* Use lean_tuple in bind_handler, bind_front_handler
|
||||
* Use mp11 in detail::variant
|
||||
* Fix buffers_cat uninitialized warning
|
||||
* Fix static_string uninitialized warning
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
@@ -51,4 +51,13 @@
|
||||
#define BOOST_BEAST_DEPRECATION_STRING \
|
||||
"This is a deprecated interface, #define BOOST_BEAST_ALLOW_DEPRECATED to allow it"
|
||||
|
||||
#ifndef BOOST_BEAST_ASSUME
|
||||
# ifdef BOOST_GCC
|
||||
# define BOOST_BEAST_ASSUME(cond) \
|
||||
do { if (!(cond)) __builtin_unreachable(); } while (0)
|
||||
# else
|
||||
# define BOOST_BEAST_ASSUME(cond) do { } while(0)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@@ -139,7 +139,9 @@ assign(static_string const& str) ->
|
||||
static_string&
|
||||
{
|
||||
n_ = str.n_;
|
||||
Traits::copy(&s_[0], &str.s_[0], n_ + 1);
|
||||
auto const n = n_ + 1;
|
||||
BOOST_BEAST_ASSUME(n != 0);
|
||||
Traits::copy(&s_[0], &str.s_[0], n);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user