ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/ealloc.c
(Generate patch)

Comparing ray/src/common/ealloc.c (file contents):
Revision 2.1 by greg, Tue Nov 12 16:54:23 1991 UTC vs.
Revision 2.9 by schorsch, Sun Mar 28 20:33:12 2004 UTC

# Line 1 | Line 1
1 /* Copyright 1988 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   *  ealloc.c - memory routines which call quit on error.
6   */
7  
8 + #include "copyright.h"
9  
10 +
11   #include  <stdio.h>
12 + #include  <stdlib.h>
13  
14 + #include "rterror.h"
15 + #include "rtmisc.h"
16  
17 < char  *malloc(), *realloc(), *emalloc(), *ecalloc(), *erealloc();
18 <
17 <
18 < char *
19 < emalloc(n)                      /* return pointer to n uninitialized bytes */
20 < unsigned  n;
17 > extern void *   /* return pointer to n uninitialized bytes */
18 > emalloc(size_t  n)
19   {
20 <        register char  *cp;
20 >        register void  *cp;
21          
22          if (n == 0)
23                  return(NULL);
# Line 29 | Line 27 | unsigned  n;
27  
28          eputs("Out of memory in emalloc\n");
29          quit(1);
30 +        return NULL; /* pro forma return */
31   }
32  
33  
34 < char *
35 < ecalloc(ne, es)                 /* return pointer to initialized memory */
37 < register unsigned  ne;
38 < unsigned  es;
34 > extern void *                   /* return pointer to initialized memory */
35 > ecalloc(register size_t ne, size_t es)
36   {
37          register char  *cp;
38          
# Line 54 | Line 51 | unsigned  es;
51   }
52  
53  
54 < char *
55 < erealloc(cp, n)                 /* reallocate cp to size n */
59 < register char  *cp;
60 < unsigned  n;
54 > extern void *                   /* reallocate cp to size n */
55 > erealloc(register void  *cp, size_t  n)
56   {
57          if (n == 0) {
58                  if (cp != NULL)
# Line 75 | Line 70 | unsigned  n;
70  
71          eputs("Out of memory in erealloc\n");
72          quit(1);
73 +        return NULL; /* pro forma return */
74   }
75  
76  
77 < efree(cp)                       /* free memory allocated by above */
78 < char  *cp;
77 > extern void                     /* free memory allocated by above */
78 > efree(void  *cp)
79   {
80          free(cp);
81   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines