URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 38 |
Rev 156 |
#include <new>
|
#include <new>
|
#include <exception_defines.h>
|
#include <exception_defines.h>
|
|
|
using std::bad_alloc;
|
using std::bad_alloc;
|
|
|
extern "C" void *malloc (std::size_t);
|
extern "C" void *malloc (std::size_t);
|
extern "C" void abort (void);
|
extern "C" void abort (void);
|
|
|
void *
|
void *
|
operator new (std::size_t sz, const std::nothrow_t&) throw()
|
operator new (std::size_t sz, const std::nothrow_t&) throw()
|
{
|
{
|
void *p;
|
void *p;
|
|
|
/* malloc (0) is unpredictable; avoid it. */
|
/* malloc (0) is unpredictable; avoid it. */
|
if (sz == 0)
|
if (sz == 0)
|
sz = 1;
|
sz = 1;
|
p = (void *) malloc (sz);
|
p = (void *) malloc (sz);
|
return p;
|
return p;
|
}
|
}
|
|
|
void *
|
void *
|
operator new (std::size_t sz) throw (std::bad_alloc)
|
operator new (std::size_t sz) throw (std::bad_alloc)
|
{
|
{
|
void *p;
|
void *p;
|
|
|
/* malloc (0) is unpredictable; avoid it. */
|
/* malloc (0) is unpredictable; avoid it. */
|
if (sz == 0)
|
if (sz == 0)
|
sz = 1;
|
sz = 1;
|
p = (void *) malloc (sz);
|
p = (void *) malloc (sz);
|
while (p == 0)
|
while (p == 0)
|
{
|
{
|
::abort();
|
::abort();
|
}
|
}
|
|
|
return p;
|
return p;
|
}
|
}
|
|
|
void*
|
void*
|
operator new[] (std::size_t sz) throw (std::bad_alloc)
|
operator new[] (std::size_t sz) throw (std::bad_alloc)
|
{
|
{
|
return ::operator new(sz);
|
return ::operator new(sz);
|
}
|
}
|
|
|
void *
|
void *
|
operator new[] (std::size_t sz, const std::nothrow_t& nothrow) throw()
|
operator new[] (std::size_t sz, const std::nothrow_t& nothrow) throw()
|
{
|
{
|
return ::operator new(sz, nothrow);
|
return ::operator new(sz, nothrow);
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.