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

Comparing ray/src/util/rcollate.c (file contents):
Revision 2.20 by greg, Tue Jun 16 19:06:29 2015 UTC vs.
Revision 2.22 by greg, Fri Mar 4 00:21:21 2016 UTC

# Line 20 | Line 20 | static const char RCSid[] = "$Id$";
20   #include <sys/mman.h>
21   #endif
22  
23 #ifdef getc_unlocked            /* avoid horrendous overhead of flockfile */
24 #undef getc
25 #undef putc
26 #define getc    getc_unlocked
27 #define putc    putc_unlocked
28 #endif
29
23   typedef struct {
24          void    *base;          /* pointer to base memory */
25          size_t  len;            /* allocated memory length */
# Line 74 | Line 67 | load_stream(MEMLOAD *mp, FILE *fp)
67                  return(-1);
68          while ((nr = fread(buf, 1, sizeof(buf), fp)) > 0) {
69                  if (!alloced)
70 <                        mp->base = malloc(nr);
70 >                        mp->base = malloc(alloced = nr);
71                  else if (mp->len+nr > alloced)
72                          mp->base = realloc(mp->base,
73                                  alloced = alloced*(2+(nr==sizeof(buf)))/2+nr);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines