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

Comparing ray/src/common/objset.c (file contents):
Revision 1.2 by greg, Thu Sep 6 23:32:41 1990 UTC vs.
Revision 1.3 by greg, Fri Sep 7 08:32:36 1990 UTC

# Line 182 | Line 182 | nonsurfinset(orig, nobjs)              /* check sets for non-surfa
182   int  orig, nobjs;
183   {
184          int  n;
185        OBJECT  *nonset;
185          register OBJECT  *os;
186 <        register OBJECT  i;
187 <                                                /* count non-surfaces */
189 <        n = 0;
190 <        for (i = orig; i < orig+nobjs; i++)
191 <                if (!issurface(objptr(i)->otype))
192 <                        n++;
193 <        if (n <= 0)
194 <                return(0);
195 <                                                /* allocate set */
196 <        if ((nonset = (OBJECT *)malloc((n+1)*sizeof(OBJECT))) == NULL)
197 <                return(0);              /* give up if we haven't enough mem */
198 <                                                /* fill set */
199 <        os = nonset;
200 <        *os = n;
201 <        for (i = orig; i < orig+nobjs; i++)
202 <                if (!issurface(objptr(i)->otype))
203 <                        *++os = i;
204 <                                                /* now check all sets */
186 >        register OBJECT  i, t;
187 >
188          for (n = 0; n < OSTSIZ; n++) {
189                  if ((os = ostable[n]) == NULL)
190                          continue;
191                  while ((i = *os++) > 0)
192                          while (i--) {
193 <                                if (*os >= nonset[1]
194 <                                                && *os <= nonset[nonset[0]]
195 <                                                && inset(nonset, *os))
196 <                                        goto done;
197 <                                os++;
193 >                                t = *os++;
194 >                                if (t >= orig && t < orig+nobjs) {
195 >                                        t = objptr(t)->otype;
196 >                                        if (!issurface(t))
197 >                                                return(1);
198 >                                }
199                          }
200          }
201 < done:
218 <        free((char *)nonset);
219 <        return(n < OSTSIZ);
201 >        return(0);
202   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines