cleanup
This commit is contained in:
parent
5e761f7fd3
commit
95dd4890cc
11
C/adtdefs.c
11
C/adtdefs.c
@ -178,13 +178,15 @@ LookupAtom(const unsigned char *atom) { /* lookup atom in atom table */
|
|||||||
na = SearchAtom(atom, a);
|
na = SearchAtom(atom, a);
|
||||||
if (na != NIL) {
|
if (na != NIL) {
|
||||||
WRITE_UNLOCK(HashChain[hash].AERWLock);
|
WRITE_UNLOCK(HashChain[hash].AERWLock);
|
||||||
return (na);
|
return na;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* add new atom to start of chain */
|
/* add new atom to start of chain */
|
||||||
|
size_t asz = strlen((const char *)atom);
|
||||||
|
|
||||||
ae = (AtomEntry *)Yap_AllocAtomSpace((sizeof *ae) +
|
ae = (AtomEntry *)Yap_AllocAtomSpace((sizeof *ae) +
|
||||||
strlen((const char *)atom) + 1);
|
asz+4);
|
||||||
if (ae == NULL) {
|
if (ae == NULL) {
|
||||||
WRITE_UNLOCK(HashChain[hash].AERWLock);
|
WRITE_UNLOCK(HashChain[hash].AERWLock);
|
||||||
return NIL;
|
return NIL;
|
||||||
@ -192,13 +194,12 @@ LookupAtom(const unsigned char *atom) { /* lookup atom in atom table */
|
|||||||
NOfAtoms++;
|
NOfAtoms++;
|
||||||
na = AbsAtom(ae);
|
na = AbsAtom(ae);
|
||||||
ae->PropsOfAE = NIL;
|
ae->PropsOfAE = NIL;
|
||||||
if (ae->UStrOfAE != atom)
|
stpncpy((char *)ae->StrOfAE, (const char *)atom, asz+1);
|
||||||
strcpy((char *)ae->StrOfAE, (const char *)atom);
|
|
||||||
ae->NextOfAE = a;
|
ae->NextOfAE = a;
|
||||||
HashChain[hash].Entry = na;
|
HashChain[hash].Entry = na;
|
||||||
INIT_RWLOCK(ae->ARWLock);
|
INIT_RWLOCK(ae->ARWLock);
|
||||||
WRITE_UNLOCK(HashChain[hash].AERWLock);
|
WRITE_UNLOCK(HashChain[hash].AERWLock);
|
||||||
|
|
||||||
if (NOfAtoms > 2 * AtomHashTableSize) {
|
if (NOfAtoms > 2 * AtomHashTableSize) {
|
||||||
Yap_signal(YAP_CDOVF_SIGNAL);
|
Yap_signal(YAP_CDOVF_SIGNAL);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user