--- ray/src/util/rcollate.c 2015/06/16 19:06:29 2.20 +++ ray/src/util/rcollate.c 2016/03/04 00:21:21 2.22 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rcollate.c,v 2.20 2015/06/16 19:06:29 greg Exp $"; +static const char RCSid[] = "$Id: rcollate.c,v 2.22 2016/03/04 00:21:21 greg Exp $"; #endif /* * Utility to re-order records in a binary or ASCII data file (matrix) @@ -20,13 +20,6 @@ static const char RCSid[] = "$Id: rcollate.c,v 2.20 20 #include #endif -#ifdef getc_unlocked /* avoid horrendous overhead of flockfile */ -#undef getc -#undef putc -#define getc getc_unlocked -#define putc putc_unlocked -#endif - typedef struct { void *base; /* pointer to base memory */ size_t len; /* allocated memory length */ @@ -74,7 +67,7 @@ load_stream(MEMLOAD *mp, FILE *fp) return(-1); while ((nr = fread(buf, 1, sizeof(buf), fp)) > 0) { if (!alloced) - mp->base = malloc(nr); + mp->base = malloc(alloced = nr); else if (mp->len+nr > alloced) mp->base = realloc(mp->base, alloced = alloced*(2+(nr==sizeof(buf)))/2+nr);