--- ray/src/common/ealloc.c 1991/11/12 16:54:23 2.1 +++ ray/src/common/ealloc.c 2004/03/28 20:33:12 2.9 @@ -1,25 +1,23 @@ -/* Copyright 1988 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: ealloc.c,v 2.9 2004/03/28 20:33:12 schorsch Exp $"; #endif - /* * ealloc.c - memory routines which call quit on error. */ +#include "copyright.h" + #include +#include +#include "rterror.h" +#include "rtmisc.h" -char *malloc(), *realloc(), *emalloc(), *ecalloc(), *erealloc(); - - -char * -emalloc(n) /* return pointer to n uninitialized bytes */ -unsigned n; +extern void * /* return pointer to n uninitialized bytes */ +emalloc(size_t n) { - register char *cp; + register void *cp; if (n == 0) return(NULL); @@ -29,13 +27,12 @@ unsigned n; eputs("Out of memory in emalloc\n"); quit(1); + return NULL; /* pro forma return */ } -char * -ecalloc(ne, es) /* return pointer to initialized memory */ -register unsigned ne; -unsigned es; +extern void * /* return pointer to initialized memory */ +ecalloc(register size_t ne, size_t es) { register char *cp; @@ -54,10 +51,8 @@ unsigned es; } -char * -erealloc(cp, n) /* reallocate cp to size n */ -register char *cp; -unsigned n; +extern void * /* reallocate cp to size n */ +erealloc(register void *cp, size_t n) { if (n == 0) { if (cp != NULL) @@ -75,11 +70,12 @@ unsigned n; eputs("Out of memory in erealloc\n"); quit(1); + return NULL; /* pro forma return */ } -efree(cp) /* free memory allocated by above */ -char *cp; +extern void /* free memory allocated by above */ +efree(void *cp) { free(cp); }