|
|
1.1 root 1: /* xmalloc.c - get memory or bust
2: Copyright (C) 1987 Free Software Foundation, Inc.
3:
4: This file is part of GAS, the GNU Assembler.
5:
6: GAS is free software; you can redistribute it and/or modify
7: it under the terms of the GNU General Public License as published by
8: the Free Software Foundation; either version 1, or (at your option)
9: any later version.
10:
11: GAS is distributed in the hope that it will be useful,
12: but WITHOUT ANY WARRANTY; without even the implied warranty of
13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: GNU General Public License for more details.
15:
16: You should have received a copy of the GNU General Public License
17: along with GAS; see the file COPYING. If not, write to
18: the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19:
20: #include <stdlib.h>
21: #include "xmalloc.h"
22: #include "messages.h"
23:
24: void *
25: xmalloc(
26: long n)
27: {
28: void *retval;
29:
30: if(!(retval = malloc((unsigned)n))){
31: as_fatal("virtual memory exceeded");
32: }
33: return(retval);
34: }
35:
36: void *
37: xrealloc(
38: void *ptr,
39: long n)
40: {
41: if((ptr = realloc(ptr, (unsigned)n)) == 0)
42: as_fatal("virtual memory exceeded");
43: return(ptr);
44: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.