Initial Contribution

This commit is contained in:
The Android Open Source Project
2008-10-21 07:00:00 -07:00
commit a27d2baa0c
1777 changed files with 163452 additions and 0 deletions

65
libstdc++/src/new.cpp Normal file
View File

@@ -0,0 +1,65 @@
#include "new"
#include <stdlib.h>
const std::nothrow_t std::nothrow = {};
void* operator new(std::size_t size)
{
void* p = malloc(size);
if (p == NULL) {
// abort();
}
return p;
}
void* operator new[](std::size_t size)
{
void* p = malloc(size);
if (p == NULL) {
// abort();
}
return p;
}
void operator delete(void* ptr)
{
if (ptr) {
free(ptr);
}
}
void operator delete[](void* ptr)
{
if (ptr) {
free(ptr);
}
}
void* operator new(std::size_t size, const std::nothrow_t&)
{
return malloc(size);
}
void* operator new[](std::size_t size, const std::nothrow_t&)
{
return malloc(size);
}
void operator delete(void* ptr, const std::nothrow_t&)
{
if (ptr) {
free(ptr);
}
}
void operator delete[](void* ptr, const std::nothrow_t&)
{
if (ptr) {
free(ptr);
}
}