Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / gnu / usr.bin / as / xrealloc.c
1 /* xrealloc.c - new memory or bust
2
3    Copyright (C) 1987, 1990, 1991, 1992 Free Software Foundation, Inc.
4
5    This file is part of GAS, the GNU Assembler.
6
7    GAS is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2, or (at your option)
10    any later version.
11
12    GAS is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with GAS; see the file COPYING.  If not, write to
19    the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
20
21
22 /*
23
24   NAME
25   xrealloc () - get more memory or bust
26   INDEX
27   xrealloc () uses realloc ()
28   SYNOPSIS
29   char   *my_memory;
30
31   my_memory = xrealloc (my_memory, 42);
32   / * my_memory gets (perhaps new) address of 42 chars * /
33
34   DESCRIPTION
35
36   Use xrealloc () as an "error-free" realloc ().It does almost the same
37   job.  When it cannot honour your request for memory it BOMBS your
38   program with a "virtual memory exceeded" message.  Realloc() returns
39   NULL and does not bomb your program.
40
41   SEE ALSO
42   realloc ()
43   */
44
45 /*
46  * $FreeBSD: src/gnu/usr.bin/as/xrealloc.c,v 1.6 1999/08/27 23:34:24 peter Exp $
47  * $DragonFly: src/gnu/usr.bin/as/Attic/xrealloc.c,v 1.2 2003/06/17 04:25:44 dillon Exp $
48  */
49 #if __STDC__ == 1
50 #include <stdlib.h>
51 #else
52 #ifdef USG
53 #include <malloc.h>
54 #else
55 char   *realloc ();
56 #endif /* USG */
57 #endif /* not __STDC__ */
58
59 #define error as_fatal
60
61 char   *
62     xrealloc (ptr, n)
63 register char  *ptr;
64 long    n;
65 {
66         void    error();
67
68         if ((ptr = realloc (ptr, (unsigned)n)) == 0)
69             error ("virtual memory exceeded");
70         return (ptr);
71 }
72
73 /* end of xrealloc.c */