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

Comparing ray/src/common/lookup.c (file contents):
Revision 2.9 by schorsch, Mon Jun 30 14:59:11 2003 UTC vs.
Revision 2.10 by schorsch, Mon Jul 21 22:30:17 2003 UTC

# Line 9 | Line 9 | static const char      RCSid[] = "$Id$";
9  
10   #include <stdio.h>
11   #include <stdlib.h>
12 #include <string.h>
12  
13   #include "lookup.h"
14  
16 #ifdef  NOSTRUCTASS
17 #define  copystruct(d,s)        memcpy((void *)(d),(void *)(s),sizeof(*(d)))
18 #else
19 #define  copystruct(d,s)        (*(d) = *(s))
20 #endif
15  
22
16   int
17   lu_init(tbl, nel)               /* initialize tbl for at least nel elements */
18   register LUTAB  *tbl;
# Line 131 | Line 124 | tryagain:
124           * recursive call to lu_find().
125           */
126          while (ndx--)
127 <                if (le[ndx].key != NULL)
127 >                if (le[ndx].key != NULL) {
128                          if (le[ndx].data != NULL)
129 <                                copystruct(lu_find(tbl,le[ndx].key), &le[ndx]);
129 >                                *lu_find(tbl,le[ndx].key) = le[ndx];
130                          else if (tbl->freek != NULL)
131                                  (*tbl->freek)(le[ndx].key);
132 +                }
133          free((void *)le);
134          goto tryagain;                  /* should happen only once! */
135   }
# Line 168 | Line 162 | int    (*f)();
162          register LUENT  *tp;
163  
164          for (tp = tbl->tabl + tbl->tsiz; tp-- > tbl->tabl; )
165 <                if (tp->data != NULL)
165 >                if (tp->data != NULL) {
166                          if (f != NULL)
167                                  rval += (*f)(tp);
168                          else
169                                  rval++;
170 +                }
171          return(rval);
172   }
173  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines