1
#include "sys-defines.h"
3
/* forward references */
4
voidptr_t xmalloc ____P((size_t length));
5
voidptr_t xrealloc ____P((voidptr_t p, size_t length));
6
voidptr_t xcalloc ____P((size_t nmemb, size_t size));
1
/* This file is part of the GNU plotutils package. Copyright (C) 1995,
2
1996, 1997, 1998, 1999, 2000, 2005, Free Software Foundation, Inc.
4
The GNU plotutils package is free software. You may redistribute it
5
and/or modify it under the terms of the GNU General Public License as
6
published by the Free Software foundation; either version 2, or (at your
7
option) any later version.
9
The GNU plotutils package is distributed in the hope that it will be
10
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
General Public License for more details.
14
You should have received a copy of the GNU General Public License along
15
with the GNU plotutils package; see the file COPYING. If not, write to
16
the Free Software Foundation, Inc., 51 Franklin St., Fifth Floor,
17
Boston, MA 02110-1301, USA. */
19
#include "libcommon.h"
10
22
xmalloc (size_t length)
17
p = (voidptr_t) malloc (length);
19
if (p == (voidptr_t) NULL)
21
perror ("out of memory");
29
xrealloc (voidptr_t p, size_t length)
36
p = (voidptr_t) realloc (p, length);
38
if (p == (voidptr_t) NULL)
40
perror ("out of memory");
25
p = (void *) malloc (length);
27
if (p == (void *) NULL)
29
perror ("out of memory");
36
xrealloc (void * p, size_t length)
38
p = (void *) realloc (p, length);
40
if (p == (void *) NULL)
42
perror ("out of memory");
48
49
xcalloc (size_t nmemb, size_t size)
55
p = (voidptr_t) calloc (nmemb, size);
52
p = (void *) calloc (nmemb, size);
57
if (p == (voidptr_t) NULL)
54
if (p == (void *) NULL)
59
56
perror ("out of memory");
60
57
exit (EXIT_FAILURE);