Example #1
0
void *
xmalloc (size_t n)
{
    void *p;

    p = malloc (n);
    if (p == NULL)
        p = fixup_null_alloc (n);
    return p;
}
Example #2
0
void *
xrealloc (void *p, size_t n)
{
    if (p == NULL)
        return xmalloc (n);
    p = realloc (p, n);
    if (p == NULL)
        p = fixup_null_alloc (n);
    return p;
}
Example #3
0
void *
xcalloc (size_t n, size_t s)
{
    void *p;

    p = calloc (n, s);
    if (p == NULL)
        p = fixup_null_alloc (n);
    return p;
}
Example #4
0
VOID *
xrealloc (VOID *p, size_t n)
{
  if (p == 0)
    return xmalloc (n);
  p = realloc (p, n);
  if (p == 0)
    p = fixup_null_alloc (n);
  return p;
}
Example #5
0
VOID *
xcalloc (size_t n, size_t s)
{
  VOID *p;

  p = calloc (n, s);
  if (p == 0)
    p = fixup_null_alloc (n);
  return p;
}
Example #6
0
VOID *
xmalloc (size_t n)
{
  VOID *p;

  p = malloc (n);
  if (p == 0)
    p = fixup_null_alloc (n);
  return p;
}
Example #7
0
void *
xnmalloc (size_t nmemb, size_t size)
{
    size_t n;
    void *p;

    if (xalloc_oversized (nmemb, size))
        xalloc_die ();
    n = nmemb * size;
    p = malloc (n);
    if (p == NULL)
        p = fixup_null_alloc (n);
    return p;
}