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

Comparing ray/src/common/malloc.c (file contents):
Revision 2.10 by greg, Fri Nov 10 17:04:15 1995 UTC vs.
Revision 2.14 by greg, Wed Apr 23 00:52:33 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1992 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   * Fast malloc for memory hogs and VM environments.
6   * Performs a minimum of searching through free lists.
# Line 22 | Line 19 | static char SCCSid[] = "$SunId$ LBL";
19   *      Greg Ward       Lawrence Berkeley Laboratory
20   */
21  
22 + #include "copyright.h"
23 +
24   #include  <errno.h>
25  
26   #ifndef  BSD
# Line 43 | Line 42 | static unsigned        m_nwasted = 0;
42   #define  NULL           0
43   #endif
44  
45 < #ifndef ALIGN
46 < #define  ALIGN          int                     /* align type */
45 > #ifndef ALIGNT
46 > #define  ALIGNT         int                     /* align type */
47   #endif
48 < #define  BYTES_WORD     sizeof(ALIGN)
48 > #define  BYTES_WORD     sizeof(ALIGNT)
49  
50   #ifndef  MAXINCR
51   #define  MAXINCR        (1<<16)                 /* largest sbrk(2) increment */
# Line 58 | Line 57 | typedef union m_head {
57                  short           magic;
58                  short           bucket;
59          }       a;
60 <        ALIGN           dummy;
60 >        ALIGNT          dummy;
61   } M_HEAD;
62  
63   #define MAGIC           0x1a2           /* magic number for allocated memory */
# Line 68 | Line 67 | typedef union m_head {
67  
68   static M_HEAD   *free_list[NBUCKETS];
69  
70 < static ALIGN    dummy_mem;
70 > static ALIGNT   dummy_mem;
71  
72   static char     *memlim[2];
73  
# Line 303 | Line 302 | register unsigned  n;
302          register int    bucket;
303          register unsigned       bsiz;
304  
305 <        if (n < 1<<FIRSTBUCKET)
305 >        if (n < 1<<FIRSTBUCKET || p == NULL)
306                  return;
307   #ifdef MSTATS
308          b_nfreed += n;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines