--- ray/src/hd/rhd_qtree.c 1997/12/24 10:50:49 3.13 +++ ray/src/hd/rhd_qtree.c 1997/12/29 17:31:45 3.14 @@ -34,9 +34,7 @@ struct rleaves qtL; /* our pile of leaves */ static RTREE **twigbundle; /* free twig blocks (NULL term.) */ static int nexttwig; /* next free twig */ -#define ungetleaf(li) (qtL.tl=(li)) /* dangerous if used improperly */ - static RTREE * newtwig() /* allocate a twig */ { @@ -89,20 +87,6 @@ int really; } -static int -newleaf() /* allocate a leaf from our pile */ -{ - int li; - - li = qtL.tl++; - if (qtL.tl >= qtL.nl) /* get next leaf in ring */ - qtL.tl = 0; - if (qtL.tl == qtL.bl) /* need to shake some free */ - qtCompost(LFREEPCT); - return(li); -} - - #define LEAFSIZ (3*sizeof(float)+sizeof(int4)+\ sizeof(TMbright)+6*sizeof(BYTE)) @@ -328,12 +312,16 @@ FVECT p, v; { register int li; - li = newleaf(); + li = qtL.tl++; + if (qtL.tl >= qtL.nl) /* advance to next leaf in ring */ + qtL.tl = 0; + if (qtL.tl == qtL.bl) /* need to shake some free */ + qtCompost(LFREEPCT); VCOPY(qtL.wp[li], p); qtL.wd[li] = encodedir(v); tmCvColrs(&qtL.brt[li], qtL.chr[li], c, 1); if (!addleaf(li)) - ungetleaf(li); + qtL.tl = li; /* unget this leaf */ }