1 /* malloc routines with error checking
3 * Copyright © 2007 Mozilla Corporation
4 * Copyright © 2009 Carl D. Worth
6 * This program 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 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 * Vladimir Vukicevic <vladimir@pobox.com>
22 * Carl Worth <cworth@cworth.org>
28 /* Allocate memory using malloc(), checking for errors.
30 * Errors: This function will exit(1) if out-of-memory occurs.
39 fprintf (stderr, "Error: out of memory. Exiting.\n");
46 /* Re-allocate memory using realloc(), checking for errors.
48 * Errors: This function will exit(1) if out-of-memory occurs.
51 xrealloc (void *ptr, size_t size)
55 ret = realloc (ptr, size);
57 fprintf (stderr, "Error: out of memory. Exiting.\n");