21 #if defined (HAVE_CONFIG_H) 28 #if defined (HAVE_UNISTD_H) 32 #if defined (HAVE_STDLIB_H) 35 # include "ansi_stdlib.h" 43 # if defined (__STDC__) 50 #if defined (HAVE_SBRK) && !HAVE_DECL_SBRK 54 #if defined (HAVE_SBRK) && defined (USING_BASH_MALLOC) 57 static size_t allocated;
66 #if defined (HAVE_SBRK) && defined (USING_BASH_MALLOC) 71 lbreak = (PTR_T)sbrk (0); \ 80 return (
char *)
sbrk (0) - (
char *)lbreak;
91 #if defined (HAVE_SBRK) && defined (USING_BASH_MALLOC) 92 allocated = findbrk ();
93 fatal_error (
_(
"%s: cannot allocate %lu bytes (%lu bytes allocated)"), func, (
unsigned long)bytes, (
unsigned long)allocated);
95 fatal_error (
_(
"%s: cannot allocate %lu bytes"), func, (
unsigned long)bytes);
153 #ifdef USING_BASH_MALLOC 157 sh_allocerr (func, bytes, file, line)
163 #if defined (HAVE_SBRK) 164 allocated = findbrk ();
165 fatal_error (
_(
"%s: %s:%d: cannot allocate %lu bytes (%lu bytes allocated)"), func, file, line, (
unsigned long)bytes, (
unsigned long)allocated);
167 fatal_error (
_(
"%s: %s:%d: cannot allocate %lu bytes"), func, file, line, (
unsigned long)bytes);
172 sh_xmalloc (bytes, file, line)
188 sh_allocerr (
"xmalloc", bytes, file, line);
194 sh_xrealloc (pointer, bytes, file, line)
211 sh_allocerr (
"xrealloc", bytes, file, line);
217 sh_xfree (
string, file, line)
char * sh_malloc(size_t bytes, const char *file, int line)
char * xmalloc(size_t bytes)
static void allocerr(char *func, size_t bytes) const
char * xrealloc(char *pointer, size_t bytes)
char * sh_realloc(char *ptr, size_t size, const char *file, int line)
void sh_free(char *mem, const char *file, int line)
void internal_warning(char *format, va_alist) const