/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1985-2012 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* Phong Vo <kpv@research.att.com> *
* *
***********************************************************************/
#include "dthdr.h"
/* Hash table with chaining for collisions.
**
** Written by Kiem-Phong Vo (05/25/96)
*/
/* these bits should be outside the scope of DT_METHODS */
/* internal data structure for hash table with chaining */
typedef struct _dthash_s
int type;
} Dthash_t;
{
ssize_t n, k;
return 0; /* fixed size table */
{ if(n < 0) /* fix table size */
n = -n;
}
}
}
/* table size should be a power of 2 */
for(k = (1<<DT_HTABLE); k < n; )
k *= 2;
return 0;
/* allocate new table */
return -1;
}
/* move objects into new table */
{ for(l = *t; l; l = next)
htbl[k] = l;
}
}
return 0;
}
{
{ for(l = *t; l; l = next)
}
}
}
{
{ if(!(l = *t) )
continue;
}
}
{
}
else
for(; t < endt; ++t)
{ if(!(l = *t) )
continue;
}
}
}
{
{ for(l = *t; l; l = l->_rght)
{ if(tail)
}
}
if(type == DT_FLATTEN)
}
}
else /* restoring a previous flattened list */
continue;
/* find the tail of the list for this slot */
;
if(!l) /* something is seriously wrong */
*t = head; /* head of list for this slot */
}
}
}
{
if(type&DT_FLATTEN)
else if(type&DT_EXTRACT)
else /* if(type&DT_RESTORE) */
}
}
}
{
ssize_t n;
if(st)
{ for(n = 0, l = *t; l; l = l->_rght)
n += 1;
if(n < DT_MAXSIZE) /* if chain length is small */
}
}
}
}
#if __STD_C
#else
int type;
#endif
{
if(!(type&DT_OPERATIONS) )
else /*if(type&(DT_EXTRACT|DT_RESTORE|DT_FLATTEN))*/
}
}
}
else
}
}
continue;
continue;
}
else break;
}
}
if(l) /* found an object, use it */
if(ll) /* found object */
}
if(pp)
}
else
}
else goto do_insert;
}
}
else /* no matching object */
do_insert: /* inserting a new object */
}
if(!lnk) /* inserting a new object */
}
}
return obj;
}
{
{ if(hash)
return 0;
return -1;
}
return 1;
}
{ if(!hash)
return 0;
return 0;
}
else return 0;
}
/* backwards compatibility */
#if defined(__EXPORT__)
#endif
#ifdef NoF
#endif