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

Comparing ray/src/meta/palloc.c (file contents):
Revision 1.2 by schorsch, Sun Jun 8 12:03:10 2003 UTC vs.
Revision 1.4 by schorsch, Sat Nov 15 02:13:37 2003 UTC

# Line 10 | Line 10 | static const char      RCSid[] = "$Id$";
10  
11  
12   #include  "meta.h"
13 + #include  "rtio.h"
14  
15  
16   extern int  maxalloc;           /* number of prims to allocate */
# Line 25 | Line 26 | PRIMITIVE *
26   palloc(void)            /* allocate a primitive */
27  
28   {
29 < register PRIMITIVE  *p;
29 >    register PRIMITIVE  *p;
30  
31 < if (maxalloc > 0 && nalloc >= maxalloc)
32 <    return(NULL);
31 >    if (maxalloc > 0 && nalloc >= maxalloc)
32 >        return(NULL);
33  
34 < if ((p = pop(&freelist)) == NULL)
35 <    if (morefree())
36 <       p = pop(&freelist);
37 <    else {
38 <       sprintf(errmsg, "out of memory in palloc (nalloc = %d)", nalloc);
39 <       error(SYSTEM, errmsg);
40 <       }
34 >    if ((p = pop(&freelist)) == NULL) {
35 >        if (morefree())
36 >            p = pop(&freelist);
37 >        else {
38 >            sprintf(errmsg, "out of memory in palloc (nalloc = %d)", nalloc);
39 >            error(SYSTEM, errmsg);
40 >        }
41 >    }
42  
43 < nalloc++;
44 < return(p);
43 >    nalloc++;
44 >    return(p);
45   }
46  
47  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines