/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1985-2010 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
* *
* 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> *
* *
***********************************************************************/
#pragma prototyped
/*
* Glenn Fowler
* AT&T Research
*
* hash table library
*/
#include "hashlib.h"
/*
* free (remove) a hash table
* can be called for partially constructed tables
* scope covered table pointer is returned
* root info freed when last reference freed
*/
{
register Hash_bucket_t* b;
register Hash_bucket_t* p;
void* handle;
if (!tab) return(0);
{
freebucket = 0;
freevalue = 0;
{
}
{
b = *sp++;
while (b)
{
p = b;
b = b->next;
if (freebucket) (*freebucket)((char*)p);
if (p->hash & HASH_FREENAME)
{
p->hash &= ~HASH_FREENAME;
}
{
else free(p);
}
else if (p->hash & HASH_HIDES)
{
p->hash &= ~HASH_HIDES;
}
}
}
{
}
}
else region = 0;
{
if (!region)
{
/*
* remove from the table lists
*/
{
{
break;
}
}
{
{
{
break;
}
}
}
}
{
}
}
return(tp);
}