mirror of
https://github.com/boostorg/beast.git
synced 2025-07-31 13:27:33 +02:00
Some basic_fields operations now give the strong exception guarantee
This commit is contained in:
@@ -2,6 +2,7 @@ Version 159:
|
|||||||
|
|
||||||
* Fix typo in release notes
|
* Fix typo in release notes
|
||||||
* Safe treatment of zero-length string arguments in basic_fields
|
* Safe treatment of zero-length string arguments in basic_fields
|
||||||
|
* Some basic_fields operations now give the strong exception guarantee
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@@ -77,6 +77,8 @@ to update to the latest Boost release.
|
|||||||
|
|
||||||
* ([issue 1026]) Advanced servers support clean shutdown via SIGINT or SIGTERM
|
* ([issue 1026]) Advanced servers support clean shutdown via SIGINT or SIGTERM
|
||||||
|
|
||||||
|
* Some basic_fields operations now give the strong exception guarantee
|
||||||
|
|
||||||
[*Fixes]
|
[*Fixes]
|
||||||
|
|
||||||
* Fix "warning: ‘const’ type qualifier on return type has no effect"
|
* Fix "warning: ‘const’ type qualifier on return type has no effect"
|
||||||
|
@@ -1219,18 +1219,19 @@ realloc_string(string_view& dest, string_view s)
|
|||||||
auto a = typename beast::detail::allocator_traits<
|
auto a = typename beast::detail::allocator_traits<
|
||||||
Allocator>::template rebind_alloc<
|
Allocator>::template rebind_alloc<
|
||||||
char>(this->member());
|
char>(this->member());
|
||||||
if(! dest.empty())
|
char* p = nullptr;
|
||||||
{
|
|
||||||
a.deallocate(const_cast<char*>(
|
|
||||||
dest.data()), dest.size());
|
|
||||||
dest = {};
|
|
||||||
}
|
|
||||||
if(! s.empty())
|
if(! s.empty())
|
||||||
{
|
{
|
||||||
auto const p = a.allocate(s.size());
|
p = a.allocate(s.size());
|
||||||
s.copy(p, s.size());
|
s.copy(p, s.size());
|
||||||
dest = {p, s.size()};
|
|
||||||
}
|
}
|
||||||
|
if(! dest.empty())
|
||||||
|
a.deallocate(const_cast<char*>(
|
||||||
|
dest.data()), dest.size());
|
||||||
|
if(p)
|
||||||
|
dest = {p, s.size()};
|
||||||
|
else
|
||||||
|
dest = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Allocator>
|
template<class Allocator>
|
||||||
@@ -1247,19 +1248,20 @@ realloc_target(
|
|||||||
auto a = typename beast::detail::allocator_traits<
|
auto a = typename beast::detail::allocator_traits<
|
||||||
Allocator>::template rebind_alloc<
|
Allocator>::template rebind_alloc<
|
||||||
char>(this->member());
|
char>(this->member());
|
||||||
if(! dest.empty())
|
char* p = nullptr;
|
||||||
{
|
|
||||||
a.deallocate(const_cast<char*>(
|
|
||||||
dest.data()), dest.size());
|
|
||||||
dest = {};
|
|
||||||
}
|
|
||||||
if(! s.empty())
|
if(! s.empty())
|
||||||
{
|
{
|
||||||
auto const p = a.allocate(1 + s.size());
|
p = a.allocate(1 + s.size());
|
||||||
p[0] = ' ';
|
p[0] = ' ';
|
||||||
s.copy(p + 1, s.size());
|
s.copy(p + 1, s.size());
|
||||||
dest = {p, 1 + s.size()};
|
|
||||||
}
|
}
|
||||||
|
if(! dest.empty())
|
||||||
|
a.deallocate(const_cast<char*>(
|
||||||
|
dest.data()), dest.size());
|
||||||
|
if(p)
|
||||||
|
dest = {p, 1 + s.size()};
|
||||||
|
else
|
||||||
|
dest = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Allocator>
|
template<class Allocator>
|
||||||
|
Reference in New Issue
Block a user