Back to index

radiance  4R0+20100331
Functions | Variables
ealloc.c File Reference
#include "copyright.h"
#include <stdio.h>
#include <stdlib.h>
#include "rterror.h"
#include "rtmisc.h"

Go to the source code of this file.

Functions

void * emalloc (size_t n)
void * ecalloc (register size_t ne, size_t es)
void * erealloc (register void *cp, size_t n)
void efree (void *cp)

Variables

static const char RCSid [] = "$Id: ealloc.c,v 2.9 2004/03/28 20:33:12 schorsch Exp $"

Function Documentation

void* ecalloc ( register size_t  ne,
size_t  es 
)

Definition at line 35 of file ealloc.c.

{
       register char  *cp;
       
       ne *= es;
       if (ne == 0)
              return(NULL);

       if ((cp = malloc(ne)) == NULL) {
              eputs("Out of memory in ecalloc\n");
              quit(1);
       }
       cp += ne;
       while (ne--)
              *--cp = 0;
       return(cp);
}

Here is the call graph for this function:

void efree ( void *  cp)

Definition at line 78 of file ealloc.c.

{
       free(cp);
}

Here is the caller graph for this function:

void* emalloc ( size_t  n)

Definition at line 18 of file ealloc.c.

{
       register void  *cp;
       
       if (n == 0)
              return(NULL);

       if ((cp = malloc(n)) != NULL)
              return(cp);

       eputs("Out of memory in emalloc\n");
       quit(1);
       return NULL; /* pro forma return */
}

Here is the call graph for this function:

Here is the caller graph for this function:

void* erealloc ( register void *  cp,
size_t  n 
)

Definition at line 55 of file ealloc.c.

{
       if (n == 0) {
              if (cp != NULL)
                     free(cp);
              return(NULL);
       }

       if (cp == NULL)
              cp = malloc(n);
       else 
              cp = realloc(cp, n);

       if (cp != NULL)
              return(cp);

       eputs("Out of memory in erealloc\n");
       quit(1);
       return NULL; /* pro forma return */
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

const char RCSid[] = "$Id: ealloc.c,v 2.9 2004/03/28 20:33:12 schorsch Exp $" [static]

Definition at line 2 of file ealloc.c.