[libcxx-commits] [libcxxabi] 5e73fda - [libc++][NFC] Consistently qualify malloc and free calls with std::
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jun 16 06:41:24 PDT 2023
Author: Louis Dionne
Date: 2023-06-16T09:40:31-04:00
New Revision: 5e73fda53ccb8c1b0fd47eba189fd742256214fb
URL: https://github.com/llvm/llvm-project/commit/5e73fda53ccb8c1b0fd47eba189fd742256214fb
DIFF: https://github.com/llvm/llvm-project/commit/5e73fda53ccb8c1b0fd47eba189fd742256214fb.diff
LOG: [libc++][NFC] Consistently qualify malloc and free calls with std::
Added:
Modified:
libcxx/src/new.cpp
libcxxabi/src/stdlib_new_delete.cpp
Removed:
################################################################################
diff --git a/libcxx/src/new.cpp b/libcxx/src/new.cpp
index 9e5248f393527..b8d24e73f0812 100644
--- a/libcxx/src/new.cpp
+++ b/libcxx/src/new.cpp
@@ -7,8 +7,8 @@
//===----------------------------------------------------------------------===//
#include <__memory/aligned_alloc.h>
+#include <cstdlib>
#include <new>
-#include <stdlib.h>
namespace std
{
@@ -52,7 +52,7 @@ operator new(std::size_t size) _THROW_BAD_ALLOC
if (size == 0)
size = 1;
void* p;
- while ((p = ::malloc(size)) == nullptr)
+ while ((p = std::malloc(size)) == nullptr)
{
// If malloc fails and there is a new_handler,
// call it to try free up memory.
@@ -118,7 +118,7 @@ _LIBCPP_WEAK
void
operator delete(void* ptr) noexcept
{
- ::free(ptr);
+ std::free(ptr);
}
_LIBCPP_WEAK
diff --git a/libcxxabi/src/stdlib_new_delete.cpp b/libcxxabi/src/stdlib_new_delete.cpp
index efe09c6c3dffc..080f932ccc60e 100644
--- a/libcxxabi/src/stdlib_new_delete.cpp
+++ b/libcxxabi/src/stdlib_new_delete.cpp
@@ -37,7 +37,7 @@ operator new(std::size_t size) _THROW_BAD_ALLOC
if (size == 0)
size = 1;
void* p;
- while ((p = ::malloc(size)) == nullptr)
+ while ((p = std::malloc(size)) == nullptr)
{
// If malloc fails and there is a new_handler,
// call it to try free up memory.
@@ -103,7 +103,7 @@ _LIBCPP_WEAK
void
operator delete(void* ptr) noexcept
{
- ::free(ptr);
+ std::free(ptr);
}
_LIBCPP_WEAK
More information about the libcxx-commits
mailing list