/*
- * $Id: util.c,v 1.58 1998/03/13 05:45:35 wessels Exp $
+ * $Id: util.c,v 1.59 1998/05/15 20:50:25 wessels Exp $
*
* DEBUG:
* AUTHOR: Harvest Derived
#endif
static int dbg_initd = 0;
+#define DBG_HASH_BUCKET(ptr) (((((int)ptr)>>4)+(((int)ptr)>>12)+(((int)ptr)>>20))&0xFF)
+
static void
check_init(void)
{
check_free(void *s)
{
int B, I;
- B = (((int) s) >> 4) & 0xFF;
+ B = DBG_HASH_BUCKET(s);
for (I = 0; I < DBG_ARRY_SZ; I++) {
if (malloc_ptrs[B][I] != s)
continue;
int B, I;
if (!dbg_initd)
check_init();
- B = (((int) p) >> 4) & 0xFF;
+ B = DBG_HASH_BUCKET(s);
for (I = 0; I < DBG_ARRY_SZ; I++) {
if (!(P = malloc_ptrs[B][I]))
continue;
xmallocblksize(void *p)
{
int B, I;
- B = (((int) p) >> 4) & 0xFF;
+ B = DBG_HASH_BUCKET(s);
for (I = 0; I < DBG_ARRY_SZ; I++) {
if (malloc_ptrs[B][I] == p)
return malloc_size[B][I];
malloc_file_name(void *p)
{
int B, I;
- B = (((int) p) >> 4) & 0xFF;
+ B = DBG_HASH_BUCKET(s);
for (I = 0; I < DBG_ARRY_SZ; I++) {
if (malloc_ptrs[B][I] == p)
return malloc_file[B][I];
malloc_line_number(void *p)
{
int B, I;
- B = (((int) p) >> 4) & 0xFF;
+ B = DBG_HASH_BUCKET(s);
for (I = 0; I < DBG_ARRY_SZ; I++) {
if (malloc_ptrs[B][I] == p)
return malloc_line[B][I];
malloc_number(void *p)
{
int B, I;
- B = (((int) p) >> 4) & 0xFF;
+ B = DBG_HASH_BUCKET(s);
for (I = 0; I < DBG_ARRY_SZ; I++) {
if (malloc_ptrs[B][I] == p)
return malloc_count[B][I];
while (ptr <= end) {
void *p = *(void **) ptr;
if (p && p != start) {
- B = (((int) p) >> 4) & 0xFF;
+ B = DBG_HASH_BUCKET(s);
for (I = 0; I < DBG_ARRY_SZ; I++) {
if (malloc_ptrs[B][I] == p) {
if (!malloc_refs[B][I]++) {