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

Comparing ray/src/hd/sm_sets.c (file contents):
Revision 3.3 by gwlarson, Wed Sep 16 18:16:29 1998 UTC vs.
Revision 3.6 by greg, Sat Feb 22 02:07:25 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1998 Silicon Graphics, Inc. */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ SGI";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   * Quadtree-specific set operations.
6   */
# Line 29 | Line 26 | QUADTREE
26   qtnewleaf(oset)                 /* return new leaf node for object set */
27   OBJECT  *oset;
28   {
29 <        register QUADTREE  osi;
29 >  register QUADTREE  osi;
30  
31 <        if (*oset <= 0)
32 <                return(EMPTY);          /* should be error? */
33 <        if (qtfreesets != EMPTY) {
34 <                osi = qtfreesets;
35 <                qtfreesets = (int)qtsettab[osi];
36 <        } else if ((osi = qtnumsets++) % QTSETIBLK == 0) {
37 <                qtsettab = (OBJECT **)realloc((char *)qtsettab,
38 <                                (unsigned)(osi+QTSETIBLK)*sizeof(OBJECT *));
39 <                if (qtsettab == NULL)
40 <                        goto memerr;
41 <        }
42 <        qtsettab[osi] = (OBJECT *)malloc(QTNODESIZ(*oset)*sizeof(OBJECT));
43 <        if (qtsettab[osi] == NULL)
44 <                goto memerr;
45 <        setcopy(qtsettab[osi], oset);
46 <        return(QT_INDEX(osi));
31 >  if (*oset <= 0)
32 >    return(EMPTY);              /* should be error? */
33 >  if (qtfreesets != EMPTY) {
34 >    osi = qtfreesets;
35 >    qtfreesets = (int)qtsettab[osi];
36 >  } else if ((osi = qtnumsets++) % QTSETIBLK == 0) {
37 >    qtsettab = (OBJECT **)realloc((char *)qtsettab,
38 >                                  (unsigned)(osi+QTSETIBLK)*sizeof(OBJECT *));
39 >    if (qtsettab == NULL)
40 >      goto memerr;
41 >  }
42 >  qtsettab[osi] = (OBJECT *)malloc(QTNODESIZ(*oset)*sizeof(OBJECT));
43 >  if (qtsettab[osi] == NULL)
44 >    goto memerr;
45 >  setcopy(qtsettab[osi], oset);
46 >  return(QT_INDEX(osi));
47   memerr:
48 <        error(SYSTEM, "out of memory in qtnewleaf");
48 >  error(SYSTEM, "out of memory in qtnewleaf");
49   }
50  
51  
# Line 70 | Line 67 | OBJECT  id;
67          lf = QT_SET_INDEX(qt);
68   #endif
69          if (qtsettab[lf][0] <= 1) {             /* blow leaf away */
70 <                free((char *)qtsettab[lf]);
70 >                free((void *)qtsettab[lf]);
71                  qtsettab[lf] = (OBJECT *)qtfreesets;
72                  qtfreesets = lf;
73                  return(EMPTY);
# Line 142 | Line 139 | QUADTREE  qt;
139          osi = QT_SET_INDEX(qt);
140          if (osi >= qtnumsets)
141                  return;
142 <        free((char *)qtsettab[osi]);
142 >        free((void *)qtsettab[osi]);
143          qtsettab[osi] = (OBJECT *)qtfreesets;
144          qtfreesets = osi;
145   }
# Line 159 | Line 156 | qtfreeleaves()                 /* free ALL sets and leaf nodes */
156          }
157          for (i = qtnumsets; i--; )
158                  if (qtsettab[i] != NULL)
159 <                        free((char *)qtsettab[i]);
160 <        free((char *)qtsettab);
159 >                        free((void *)qtsettab[i]);
160 >        free((void *)qtsettab);
161          qtsettab = NULL;
162          qtnumsets = 0;
163   }
# Line 195 | Line 192 | register OBJECT  *cs;                   /* cs' = cs +
192      for (i = os[0]; i-- >= 0; )
193         *cs++ = *os++;
194   }
195 +
196 +
197 +
198 +
199 +
200 +
201 +
202 +
203  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines