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

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [ld/] [testsuite/] [ld-elf/] [new.cc] - Blame information for rev 95

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

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

powered by: WebSVN 2.1.0

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