From 8f92500fa93d174d077af28d8af3e3cb732e0aff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Goddard=20Rosa?= Date: Sat, 30 Jan 2010 22:26:30 -0200 Subject: optimize delete/delete[] operators by removing unneeded branch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove redundant not NULL check already done in free(). Signed-off-by: André Goddard Rosa --- libstdc++/src/new.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/libstdc++/src/new.cpp b/libstdc++/src/new.cpp index 8189159..a9c92d4 100644 --- a/libstdc++/src/new.cpp +++ b/libstdc++/src/new.cpp @@ -23,16 +23,12 @@ void* operator new[](std::size_t size) void operator delete(void* ptr) { - if (ptr) { - free(ptr); - } + free(ptr); } void operator delete[](void* ptr) { - if (ptr) { - free(ptr); - } + free(ptr); } void* operator new(std::size_t size, const std::nothrow_t&) @@ -47,16 +43,12 @@ void* operator new[](std::size_t size, const std::nothrow_t&) void operator delete(void* ptr, const std::nothrow_t&) { - if (ptr) { - free(ptr); - } + free(ptr); } void operator delete[](void* ptr, const std::nothrow_t&) { - if (ptr) { - free(ptr); - } + free(ptr); } -- cgit v1.1