--- ray/src/common/lookup.c 2003/06/30 14:59:11 2.9 +++ ray/src/common/lookup.c 2003/07/21 22:30:17 2.10 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: lookup.c,v 2.9 2003/06/30 14:59:11 schorsch Exp $"; +static const char RCSid[] = "$Id: lookup.c,v 2.10 2003/07/21 22:30:17 schorsch Exp $"; #endif /* * Table lookup routines @@ -9,17 +9,10 @@ static const char RCSid[] = "$Id: lookup.c,v 2.9 2003/ #include #include -#include #include "lookup.h" -#ifdef NOSTRUCTASS -#define copystruct(d,s) memcpy((void *)(d),(void *)(s),sizeof(*(d))) -#else -#define copystruct(d,s) (*(d) = *(s)) -#endif - int lu_init(tbl, nel) /* initialize tbl for at least nel elements */ register LUTAB *tbl; @@ -131,11 +124,12 @@ tryagain: * recursive call to lu_find(). */ while (ndx--) - if (le[ndx].key != NULL) + if (le[ndx].key != NULL) { if (le[ndx].data != NULL) - copystruct(lu_find(tbl,le[ndx].key), &le[ndx]); + *lu_find(tbl,le[ndx].key) = le[ndx]; else if (tbl->freek != NULL) (*tbl->freek)(le[ndx].key); + } free((void *)le); goto tryagain; /* should happen only once! */ } @@ -168,11 +162,12 @@ int (*f)(); register LUENT *tp; for (tp = tbl->tabl + tbl->tsiz; tp-- > tbl->tabl; ) - if (tp->data != NULL) + if (tp->data != NULL) { if (f != NULL) rval += (*f)(tp); else rval++; + } return(rval); }