diff options
author | Alexander Blair <snipa@jagtech.io> | 2020-12-10 17:33:50 -0800 |
---|---|---|
committer | Alexander Blair <snipa@jagtech.io> | 2020-12-10 17:33:50 -0800 |
commit | 6bddd54f9d1195c4dcef04e096474c2ff7066f1d (patch) | |
tree | 6b775ea0a35f36ad17a7d0945eedc8ba7d0f4e1f /contrib/epee/include/byte_stream.h | |
parent | Merge pull request #6977 (diff) | |
parent | Change to more efficient allocation strategy in byte_stream (diff) | |
download | monero-6bddd54f9d1195c4dcef04e096474c2ff7066f1d.tar.xz |
Merge pull request #7003
08eb0949f Change to more efficient allocation strategy in byte_stream (Lee Clagett)
Diffstat (limited to 'contrib/epee/include/byte_stream.h')
-rw-r--r-- | contrib/epee/include/byte_stream.h | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/contrib/epee/include/byte_stream.h b/contrib/epee/include/byte_stream.h index 42a9e1dd9..30abd050d 100644 --- a/contrib/epee/include/byte_stream.h +++ b/contrib/epee/include/byte_stream.h @@ -58,7 +58,6 @@ namespace epee byte_buffer buffer_; //! Beginning of buffer std::uint8_t* next_write_; //! Current write position const std::uint8_t* end_; //! End of buffer - std::size_t increase_size_; //! Minimum buffer size increase //! \post `requested <= available()` void overflow(const std::size_t requested); @@ -75,29 +74,17 @@ namespace epee using char_type = std::uint8_t; using Ch = char_type; - //! \return Default minimum size increase on buffer overflow - static constexpr std::size_t default_increase() noexcept { return 4096; } - //! Increase internal buffer by at least `byte_stream_increase` bytes. byte_stream() noexcept - : byte_stream(default_increase()) - {} - - //! Increase internal buffer by at least `increase` bytes. - explicit byte_stream(const std::size_t increase) noexcept : buffer_(nullptr), next_write_(nullptr), - end_(nullptr), - increase_size_(increase) + end_(nullptr) {} byte_stream(byte_stream&& rhs) noexcept; ~byte_stream() noexcept = default; byte_stream& operator=(byte_stream&& rhs) noexcept; - //! \return The minimum increase size on buffer overflow - std::size_t increase_size() const noexcept { return increase_size_; } - const std::uint8_t* data() const noexcept { return buffer_.get(); } std::uint8_t* tellp() const noexcept { return next_write_; } std::size_t available() const noexcept { return end_ - next_write_; } |