Back to index

glibc  2.9
Defines | Functions | Variables
xmalloc.c File Reference
#include <sys/types.h>
#include <libintl.h>
#include "error.h"

Go to the source code of this file.

Defines

#define VOID   char
#define _(str)   gettext (str)
#define EXIT_FAILURE   4

Functions

VOIDcalloc ()
VOIDmalloc ()
VOIDrealloc ()
void free ()
static VOIDfixup_null_alloc (size_t n)
VOIDxmalloc (size_t n)
VOIDxcalloc (size_t n, size_t s)
VOIDxrealloc (VOID *p, size_t n)

Variables

int xmalloc_exit_failure = EXIT_FAILURE

Define Documentation

#define _ (   str)    gettext (str)

Definition at line 49 of file xmalloc.c.

#define EXIT_FAILURE   4

Definition at line 53 of file xmalloc.c.

#define VOID   char

Definition at line 27 of file xmalloc.c.


Function Documentation

VOID* calloc ( )
static VOID* fixup_null_alloc ( size_t  n) [static]

Definition at line 61 of file xmalloc.c.

{
  VOID *p;

  p = 0;
  if (n == 0)
    p = malloc ((size_t) 1);
  if (p == 0)
    error (xmalloc_exit_failure, 0, _("memory exhausted"));
  return p;
}

Here is the caller graph for this function:

void free ( )
VOID* malloc ( )
VOID* realloc ( )
VOID* xcalloc ( size_t  n,
size_t  s 
)

Definition at line 91 of file xmalloc.c.

{
  VOID *p;

  p = calloc (n, s);
  if (p == 0)
    p = fixup_null_alloc (n);
  return p;
}

Here is the call graph for this function:

Here is the caller graph for this function:

VOID* xmalloc ( size_t  n)

Definition at line 77 of file xmalloc.c.

{
  VOID *p;

  p = malloc (n);
  if (p == 0)
    p = fixup_null_alloc (n);
  return p;
}

Here is the call graph for this function:

VOID* xrealloc ( VOID p,
size_t  n 
)

Definition at line 107 of file xmalloc.c.

{
  if (p == 0)
    return xmalloc (n);
  p = realloc (p, n);
  if (p == 0)
    p = fixup_null_alloc (n);
  return p;
}

Here is the call graph for this function:


Variable Documentation

Definition at line 58 of file xmalloc.c.