-DESCRIPTION
- Like <<malloc>>, but exit if no more memory.
-
-*/
-
-/** There is major inconsistency in how running out of memory is handled.
- Some routines return a NULL, and set bfd_error to no_memory.
- However, obstack routines can't do this ... */
-
-
-DEFUN(PTR bfd_xmalloc,(size),
- bfd_size_type size)
-{
- static CONST char no_memory_message[] = "Virtual memory exhausted!\n";
- PTR ptr;
- if (size == 0) size = 1;
- ptr = (PTR)malloc((size_t) size);
- if (!ptr)
- {
- write (2, no_memory_message, sizeof(no_memory_message)-1);
- exit (1);
- }