[libcxx-commits] [PATCH] D93339: [libc++abi] Remove redundant null pointer check in operator delete
Fangrui Song via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Dec 15 13:39:54 PST 2020
MaskRay created this revision.
MaskRay added a reviewer: libc++abi.
MaskRay requested review of this revision.
Herald added a project: libc++abi.
Herald added a subscriber: libcxx-commits.
Herald added 1 blocking reviewer(s): libc++abi.
Similar to D52401 <https://reviews.llvm.org/D52401>. Normally operator delete is defined in libc++abi
(LIBCPP_DISABLE_NEW_DELETE_DEFINITIONS is off by default).
C89 4.10.3.2 The free function
C99 7.20.3.2 The free function
C11 7.22.3.3 The free function
If ptr is a null pointer, no action shall occur.
free on MSDN:
If memblock is NULL, the pointer is ignored and free immediately returns.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D93339
Files:
libcxxabi/src/stdlib_new_delete.cpp
Index: libcxxabi/src/stdlib_new_delete.cpp
===================================================================
--- libcxxabi/src/stdlib_new_delete.cpp
+++ libcxxabi/src/stdlib_new_delete.cpp
@@ -93,8 +93,7 @@
void
operator delete(void* ptr) _NOEXCEPT
{
- if (ptr)
- ::free(ptr);
+ ::free(ptr);
}
_LIBCXXABI_WEAK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93339.312021.patch
Type: text/x-patch
Size: 332 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20201215/a0c2a55b/attachment.bin>
More information about the libcxx-commits
mailing list