Remove FMT_SAFEBUFFERS (#1966)

This commit is contained in:
Victor Zverovich
2020-10-29 17:42:45 -07:00
parent 4081b2fe94
commit 112755cf91
2 changed files with 11 additions and 21 deletions

View File

@@ -745,8 +745,10 @@ void basic_memory_buffer<T, SIZE, Allocator>::grow(size_t size) {
const size_t max_size = std::allocator_traits<Allocator>::max_size(alloc_);
size_t old_capacity = this->capacity();
size_t new_capacity = old_capacity + old_capacity / 2;
if (size > new_capacity) new_capacity = size;
else if (new_capacity > max_size) new_capacity = (std::max)(size, max_size);
if (size > new_capacity)
new_capacity = size;
else if (new_capacity > max_size)
new_capacity = (std::max)(size, max_size);
T* old_data = this->data();
T* new_data =
std::allocator_traits<Allocator>::allocate(alloc_, new_capacity);
@@ -979,13 +981,6 @@ template <> int count_digits<4>(detail::fallback_uintptr n);
# define FMT_ALWAYS_INLINE inline
#endif
// To suppress unnecessary security cookie checks
#if FMT_MSC_VER && !FMT_CLANG_VERSION
# define FMT_SAFEBUFFERS __declspec(safebuffers)
#else
# define FMT_SAFEBUFFERS
#endif
#ifdef FMT_BUILTIN_CLZ
// Optional version of count_digits for better performance on 32-bit platforms.
inline int count_digits(uint32_t n) {