Commit 6babc2e3 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook GitHub Bot

cut allocateBytes, deallocateBytes

Summary: They are replaced by `operator_new` and `operator_delete`.

Reviewed By: luciang

Differential Revision: D33180955

fbshipit-source-id: 891fc10fa53a5b53928321ba87a8d46e5953d188
parent 9b61f262
......@@ -42,21 +42,6 @@
namespace folly {
/// allocateBytes and deallocateBytes work like a checkedMalloc/free pair,
/// but take advantage of sized deletion when available
inline void* allocateBytes(size_t n) {
return ::operator new(n);
}
inline void deallocateBytes(void* p, size_t n) {
#if defined(__cpp_sized_deallocation)
return ::operator delete(p, n);
#else
(void)n;
return ::operator delete(p);
#endif
}
#if (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) || \
(defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 600) || \
(defined(__ANDROID__) && (__ANDROID_API__ > 16)) || \
......
......@@ -37,17 +37,6 @@ static constexpr std::size_t kTooBig = folly::constexpr_max(
std::size_t{std::numeric_limits<uint32_t>::max()},
std::size_t{1} << (8 * sizeof(std::size_t) - 14));
TEST(allocateBytes, simple) {
auto p = allocateBytes(10);
EXPECT_TRUE(p != nullptr);
deallocateBytes(p, 10);
}
TEST(allocateBytes, zero) {
auto p = allocateBytes(0);
deallocateBytes(p, 0);
}
TEST(operatorNewDelete, zero) {
auto p = ::operator new(0);
EXPECT_TRUE(p != nullptr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment