--- ray/src/common/modobject.c 1996/12/15 15:45:17 2.4 +++ ray/src/common/modobject.c 2003/09/30 00:13:58 2.11 @@ -1,13 +1,14 @@ -/* Copyright (c) 1992 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: modobject.c,v 2.11 2003/09/30 00:13:58 greg Exp $"; #endif - /* * Routines for tracking object modifiers + * + * External symbols declared in object.h */ +#include "copyright.h" + #include "standard.h" #include "object.h" @@ -15,32 +16,30 @@ static char SCCSid[] = "$SunId$ LBL"; #include "otypes.h" -extern int (*addobjnotify[])(); /* people to notify of new objects */ - static struct ohtab { int hsiz; /* current table size */ OBJECT *htab; /* table, if allocated */ } modtab = {100, NULL}, objtab = {1000, NULL}; /* modifiers and objects */ -static int otndx(); +static int otndx(char *, struct ohtab *); -int +OBJECT objndx(op) /* get object number from pointer */ register OBJREC *op; { register int i, j; - for (i = nobjects>>6; i >= 0; i--) { + for (i = nobjects>>OBJBLKSHFT; i >= 0; i--) { j = op - objblock[i]; - if (j >= 0 && j < 077) - return((i<<6) + j); + if (j >= 0 && j < OBJBLKSIZ) + return((i<hsiz; i++) { - ndx = (hval + i*i) % tab->hsiz; + ndx = (hval + (unsigned long)i*i) % tab->hsiz; if (tab->htab[ndx] == OVOID || !strcmp(objptr(tab->htab[ndx])->oname, name)) return(ndx); @@ -156,6 +172,6 @@ tryagain: i = otndx(objptr(oldhtab[ndx])->oname, tab); tab->htab[i] = oldhtab[ndx]; } - free((char *)oldhtab); + free((void *)oldhtab); goto tryagain; /* should happen only once! */ }