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

Comparing ray/src/common/calexpr.c (file contents):
Revision 2.46 by greg, Sat Feb 24 19:26:44 2024 UTC vs.
Revision 2.47 by greg, Sun Feb 25 04:11:10 2024 UTC

# Line 218 | Line 218 | epflatten(                     /* flatten hierarchies for '+', '*' */
218   {
219      EPNODE      *ep;
220  
221 <    if (epar->nkids < 0)        /* we don't really handle this properly */
222 <        epar->nkids *= -1;
223 <
221 >    if (epar->nkids < 0) {
222 >        eputs("Cannot flatten EPNODE array\n");
223 >        quit(1);
224 >    }
225      for (ep = epar->v.kid; ep != NULL; ep = ep->sibling)
226          while (ep->type == epar->type) {
227              EPNODE      *ep1 = ep->v.kid;
# Line 236 | Line 237 | epflatten(                     /* flatten hierarchies for '+', '*' */
237  
238  
239   void
240 < epoptimize(                     /* flatten operations and lists -> arrays */
240 > epoptimize(                     /* flatten operations, lists -> arrays */
241          EPNODE  *epar
242   )
243   {
244      EPNODE      *ep;
245  
246      if ((epar->type == '+') | (epar->type == '*'))
247 <        epflatten(epar);        /* commutative & associative */
247 >        epflatten(epar);        /* flatten associative operations */
248  
249      if (epar->nkids)            /* do children if any */
250          for (ep = epar->v.kid; ep != NULL; ep = ep->sibling)
# Line 562 | Line 563 | addekid(                       /* add a child to ep */
563      EPNODE      *ek
564   )
565   {
566 <    if (ep->nkids < 0)          /* we don't really handle this properly */
567 <        ep->nkids *= -1;
566 >    if (ep->nkids < 0) {
567 >        eputs("Cannot add kid to EPNODE array\n");
568 >        quit(1);
569 >    }
570      ep->nkids++;
571      if (ep->v.kid == NULL)
572          ep->v.kid = ek;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines