summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndré Goddard Rosa <andre.goddard@gmail.com>2010-01-30 22:26:30 -0200
committerAndré Goddard Rosa <andre.goddard@gmail.com>2010-01-30 22:26:30 -0200
commit8f92500fa93d174d077af28d8af3e3cb732e0aff (patch)
tree8dbb819efaf6b071dab7467dd23d8db15aa59ec6
parent95604529ec25fe7923ba88312c590f38aa5e3d9e (diff)
downloadbionic-8f92500fa93d174d077af28d8af3e3cb732e0aff.zip
bionic-8f92500fa93d174d077af28d8af3e3cb732e0aff.tar.gz
bionic-8f92500fa93d174d077af28d8af3e3cb732e0aff.tar.bz2
optimize delete/delete[] operators by removing unneeded branch
Remove redundant not NULL check already done in free(). Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
-rw-r--r--libstdc++/src/new.cpp16
1 files 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);
}