OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [binutils-2.18.50/] [ld/] [testsuite/] [ld-elf/] [new.cc] - Blame information for rev 310

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
#include <new>
2
#include <exception_defines.h>
3
 
4
using std::bad_alloc;
5
 
6
extern "C" void *malloc (std::size_t);
7
extern "C" void abort (void);
8
 
9
void *
10
operator new (std::size_t sz, const std::nothrow_t&) throw()
11
{
12
  void *p;
13
 
14
  /* malloc (0) is unpredictable; avoid it.  */
15
  if (sz == 0)
16
    sz = 1;
17
  p = (void *) malloc (sz);
18
  return p;
19
}
20
 
21
void *
22
operator new (std::size_t sz) throw (std::bad_alloc)
23
{
24
  void *p;
25
 
26
  /* malloc (0) is unpredictable; avoid it.  */
27
  if (sz == 0)
28
    sz = 1;
29
  p = (void *) malloc (sz);
30
  while (p == 0)
31
    {
32
      ::abort();
33
    }
34
 
35
  return p;
36
}
37
 
38
void*
39
operator new[] (std::size_t sz) throw (std::bad_alloc)
40
{
41
  return ::operator new(sz);
42
}
43
 
44
void *
45
operator new[] (std::size_t sz, const std::nothrow_t& nothrow) throw()
46
{
47
  return ::operator new(sz, nothrow);
48
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.