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

Comparing ray/src/hd/holofile.c (file contents):
Revision 3.38 by gwlarson, Thu Feb 25 13:25:38 1999 UTC vs.
Revision 3.39 by gwlarson, Tue Mar 9 08:40:11 1999 UTC

# Line 30 | Line 30 | static char SCCSid[] = "$SunId$ SGI";
30   #endif
31   #ifndef FF_DEFAULT
32                                  /* when to free a beam fragment */
33 < #define FF_DEFAULT      (FF_ALLOC|FF_WRITE|FF_KILL)
33 > #define FF_DEFAULT      (FF_WRITE|FF_KILL)
34   #endif
35   #ifndef MINDIRSEL
36                                  /* minimum directory seek length */
# Line 559 | Line 559 | int    i;
559          biglob(hp)->nrd -= bi->nrd;             /* tell fragment it's free */
560          bi->nrd = 0;
561          bi->fo = 0L;
562 +        hdmarkdirty(hp, i);                     /* assume we'll reallocate */
563          return(1);
564   }
565  
# Line 621 | Line 622 | hdsyncbeam(hp, i)              /* sync beam in memory with beam on
622   register HOLO   *hp;
623   register int    i;
624   {
625 +        int     fragfreed;
626          unsigned int4   nrays;
627          unsigned int    n;
628          long    nfo;
# Line 632 | Line 634 | register int   i;
634                                          /* is current fragment OK? */
635          if (hp->bl[i] == NULL || (nrays = hp->bl[i]->nrm) == hp->bi[i].nrd)
636                  return(0);
637 <        if (hdfragflags&FF_WRITE && hp->bi[i].nrd)
638 <                hdfreefrag(hp, i);      /* relinquish old fragment */
637 >                                        /* relinquish old fragment? */
638 >        fragfreed = hdfragflags&FF_WRITE && hp->bi[i].nrd && hdfreefrag(hp,i);
639          if (nrays) {                    /* get and write new fragment */
640                  nfo = hdallocfrag(hp->fd, nrays);
641                  errno = 0;
# Line 650 | Line 652 | register int   i;
652                  hp->bi[i].fo = 0L;
653          biglob(hp)->nrd += nrays - hp->bi[i].nrd;
654          hp->bi[i].nrd = nrays;
655 <        hdmarkdirty(hp, i);             /* section directory now out of date */
655 >        if (!fragfreed)
656 >                hdmarkdirty(hp, i);             /* need to flag dir. ent. */
657          return(1);
658   }
659  
# Line 726 | Line 729 | register int   i;
729          if (hp->bl[i] != NULL) {        /* free memory */
730                  blglob(hp)->nrm -= nchanged = hp->bl[i]->nrm;
731                  free((char *)hp->bl[i]);
732 +                hp->bl[i] = NULL;
733          } else
734                  nchanged = hp->bi[i].nrd;
735 <        if (hp->bi[i].nrd) {
736 <                if (hdfragflags&FF_KILL)
737 <                        hdfreefrag(hp, i);
734 <                biglob(hp)->nrd -= hp->bi[i].nrd;
735 <                hp->bi[i].nrd = 0;      /* make sure it's gone */
735 >        if (hp->bi[i].nrd && !(hdfragflags&FF_KILL && hdfreefrag(hp,i))) {
736 >                biglob(hp)->nrd -= hp->bi[i].nrd;       /* free failed */
737 >                hp->bi[i].nrd = 0;
738                  hp->bi[i].fo = 0L;
739 +                hdmarkdirty(hp, i);
740          }
738        hp->bl[i] = NULL;
741          return(nchanged);
742   }
743  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines