[PATCH] D52401: Remove redundant null pointer check in operator delete

Fangrui Song via Phabricator reviews at reviews.llvm.org
Mon Sep 24 19:52:37 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL342936: Remove redundant null pointer check in operator delete (authored by MaskRay, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D52401

Files:
  libcxx/trunk/src/new.cpp


Index: libcxx/trunk/src/new.cpp
===================================================================
--- libcxx/trunk/src/new.cpp
+++ libcxx/trunk/src/new.cpp
@@ -135,8 +135,7 @@
 void
 operator delete(void* ptr) _NOEXCEPT
 {
-    if (ptr)
-        ::free(ptr);
+    ::free(ptr);
 }
 
 _LIBCPP_WEAK
@@ -257,11 +256,10 @@
 void
 operator delete(void* ptr, std::align_val_t) _NOEXCEPT
 {
-    if (ptr)
 #if defined(_LIBCPP_MSVCRT_LIKE)
-        ::_aligned_free(ptr);
+    ::_aligned_free(ptr);
 #else
-        ::free(ptr);
+    ::free(ptr);
 #endif
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52401.166797.patch
Type: text/x-patch
Size: 551 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20180925/e64879cd/attachment.bin>


More information about the libcxx-commits mailing list