0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-15 22:41:12 +01:00

ircd::buffer: Increase restrictions for unique_buffer<>.

This commit is contained in:
Jason Volk 2019-04-12 09:57:57 -07:00
parent 15bd7282c7
commit 541dbadf2f
3 changed files with 11 additions and 9 deletions

View file

@ -24,12 +24,12 @@ struct ircd::buffer::unique_buffer
{ {
buffer release(); buffer release();
unique_buffer() = default;
unique_buffer(const size_t &size, const size_t &align = 0); unique_buffer(const size_t &size, const size_t &align = 0);
explicit unique_buffer(const buffer &); explicit unique_buffer(const buffer &);
unique_buffer() = default; explicit unique_buffer(unique_buffer &&) noexcept;
unique_buffer(unique_buffer &&) noexcept;
unique_buffer(const unique_buffer &) = delete; unique_buffer(const unique_buffer &) = delete;
unique_buffer &operator=(unique_buffer &&) noexcept; unique_buffer &operator=(unique_buffer &&) & noexcept;
unique_buffer &operator=(const unique_buffer &) = delete; unique_buffer &operator=(const unique_buffer &) = delete;
~unique_buffer() noexcept; ~unique_buffer() noexcept;
}; };
@ -58,8 +58,7 @@ ircd::buffer::unique_buffer<buffer>::unique_buffer(const size_t &size,
{ {
aligned_alloc(align, size).release(), size aligned_alloc(align, size).release(), size
} }
{ {}
}
template<class buffer> template<class buffer>
ircd::buffer::unique_buffer<buffer>::unique_buffer(unique_buffer &&other) ircd::buffer::unique_buffer<buffer>::unique_buffer(unique_buffer &&other)
@ -75,7 +74,7 @@ noexcept
template<class buffer> template<class buffer>
ircd::buffer::unique_buffer<buffer> & ircd::buffer::unique_buffer<buffer> &
ircd::buffer::unique_buffer<buffer>::operator=(unique_buffer &&other) ircd::buffer::unique_buffer<buffer>::operator=(unique_buffer &&other)
noexcept & noexcept
{ {
this->~unique_buffer(); this->~unique_buffer();

View file

@ -339,9 +339,9 @@ download(const mutable_buffer &head_buf,
parse::buffer pb{remote_request.in.head}; parse::buffer pb{remote_request.in.head};
parse::capstan pc{pb}; parse::capstan pc{pb};
pc.read += size(remote_request.in.head); pc.read += size(remote_request.in.head);
return return std::pair<http::response::head, unique_buffer<mutable_buffer>>
{ {
http::response::head{pc}, std::move(remote_request.in.dynamic) pc, std::move(remote_request.in.dynamic)
}; };
} }

View file

@ -159,5 +159,8 @@ request_url(const string_view &urle)
return {}; return {};
assert(data(request.in.content) == data(request.in.dynamic)); assert(data(request.in.content) == data(request.in.dynamic));
return std::move(request.in.dynamic); return unique_buffer<mutable_buffer>
{
std::move(request.in.dynamic)
};
} }