--- ray/src/hd/holofile.c 1999/01/09 09:16:14 3.33 +++ ray/src/hd/holofile.c 1999/02/01 09:56:18 3.36 @@ -13,8 +13,12 @@ static char SCCSid[] = "$SunId$ SGI"; #include "holo.h" #ifndef CACHESIZE -#define CACHESIZE 16 /* default cache size (Mbytes, 0==inf) */ +#ifdef BIGMEM +#define CACHESIZE 32 /* default cache size (Mbytes, 0==inf) */ +#else +#define CACHESIZE 12 #endif +#endif #ifndef FREEBEAMS #define FREEBEAMS 1500 /* maximum beams to free at a time */ #endif @@ -554,7 +558,7 @@ int i; } biglob(hp)->nrd -= bi->nrd; /* tell fragment it's free */ bi->nrd = 0; - bi->fo = 0; + bi->fo = 0L; return(1); } @@ -644,7 +648,8 @@ register int i; hp->bi[i].fo = nfo; } else hp->bi[i].fo = 0L; - biglob(hp)->nrd += hp->bi[i].nrd = nrays; + biglob(hp)->nrd += nrays - hp->bi[i].nrd; + hp->bi[i].nrd = nrays; markdirty(hp, i); /* section directory now out of date */ return(1); } @@ -666,10 +671,14 @@ register int i; if (hdfragl[hp->fd].writerr) /* check for file error */ return(0); if (i == 0) { /* clear entire holodeck */ + if (blglob(hp)->nrm == 0) + return(0); /* already clear */ nchanged = 0; for (i = nbeams(hp); i > 0; i--) if (hp->bl[i] != NULL) nchanged += hdfreebeam(hp, i); + DCHECK(blglob(hp)->nrm != 0, + CONSISTENCY, "bad beam count in hdfreebeam"); return(nchanged); } DCHECK(i < 1 | i > nbeams(hp), @@ -701,7 +710,10 @@ register int i; return(nchanged); } if (i == 0) { /* clobber entire holodeck */ + if (biglob(hp)->nrd == 0 & blglob(hp)->nrm == 0) + return(0); /* already empty */ nchanged = 0; + nchanged = 0; for (i = nbeams(hp); i > 0; i--) if (hp->bi[i].nrd > 0 || hp->bl[i] != NULL) nchanged += hdkillbeam(hp, i); @@ -719,6 +731,7 @@ register int i; if (hp->bi[i].nrd) { if (hdfragflags&FF_KILL) hdfreefrag(hp, i); + biglob(hp)->nrd -= hp->bi[i].nrd; hp->bi[i].nrd = 0; /* make sure it's gone */ hp->bi[i].fo = 0L; }