37 |
void free (); |
void free (); |
38 |
#endif |
#endif |
39 |
|
|
40 |
|
# include <stdio.h> |
41 |
|
|
42 |
#if ENABLE_NLS |
#if ENABLE_NLS |
43 |
# include <libintl.h> |
# include <libintl.h> |
44 |
# define _(Text) gettext (Text) |
# define _(Text) gettext (Text) |
47 |
# define _(Text) Text |
# define _(Text) Text |
48 |
#endif |
#endif |
49 |
|
|
|
#include "error.h" |
|
|
|
|
50 |
#ifndef EXIT_FAILURE |
#ifndef EXIT_FAILURE |
51 |
# define EXIT_FAILURE 1 |
# define EXIT_FAILURE 1 |
52 |
#endif |
#endif |
65 |
The caller may set it to some other value. */ |
The caller may set it to some other value. */ |
66 |
int xmalloc_exit_failure = EXIT_FAILURE; |
int xmalloc_exit_failure = EXIT_FAILURE; |
67 |
|
|
|
#if __STDC__ && (HAVE_VPRINTF || HAVE_DOPRNT) |
|
|
void error (int, int, const char *, ...); |
|
|
#else |
|
|
void error (); |
|
|
#endif |
|
|
|
|
68 |
static VOID * |
static VOID * |
69 |
fixup_null_alloc (n) |
fixup_null_alloc (n) |
70 |
size_t n; |
size_t n; |
75 |
if (n == 0) |
if (n == 0) |
76 |
p = malloc ((size_t) 1); |
p = malloc ((size_t) 1); |
77 |
if (p == 0) |
if (p == 0) |
78 |
error (xmalloc_exit_failure, 0, _("Memory exhausted")); |
{ |
79 |
|
fprintf (stderr, "%s: %s\n", PACKAGE, _("Memory exhausted")); |
80 |
|
exit (xmalloc_exit_failure); |
81 |
|
} |
82 |
return p; |
return p; |
83 |
} |
} |
84 |
|
|