avoi ugly unsigned char *
This commit is contained in:
parent
78ef33c463
commit
98d7b2d7f8
18
C/adtdefs.c
18
C/adtdefs.c
@ -123,7 +123,7 @@ SearchInInvisible(const char *atom)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline Atom
|
static inline Atom
|
||||||
SearchAtom(unsigned char *p, Atom a) {
|
SearchAtom(const char *p, Atom a) {
|
||||||
AtomEntry *ae;
|
AtomEntry *ae;
|
||||||
|
|
||||||
/* search atom in chain */
|
/* search atom in chain */
|
||||||
@ -156,19 +156,19 @@ static Atom
|
|||||||
LookupAtom(const char *atom)
|
LookupAtom(const char *atom)
|
||||||
{ /* lookup atom in atom table */
|
{ /* lookup atom in atom table */
|
||||||
UInt hash;
|
UInt hash;
|
||||||
unsigned char *p;
|
const char *p;
|
||||||
Atom a, na;
|
Atom a, na;
|
||||||
AtomEntry *ae;
|
AtomEntry *ae;
|
||||||
|
|
||||||
/* compute hash */
|
/* compute hash */
|
||||||
p = (unsigned char *)atom;
|
p = atom;
|
||||||
hash = HashFunction(p) % AtomHashTableSize;
|
hash = HashFunction(p) % AtomHashTableSize;
|
||||||
|
|
||||||
/* we'll start by holding a read lock in order to avoid contention */
|
/* we'll start by holding a read lock in order to avoid contention */
|
||||||
READ_LOCK(HashChain[hash].AERWLock);
|
READ_LOCK(HashChain[hash].AERWLock);
|
||||||
a = HashChain[hash].Entry;
|
a = HashChain[hash].Entry;
|
||||||
/* search atom in chain */
|
/* search atom in chain */
|
||||||
na = SearchAtom((unsigned char *)atom, a);
|
na = SearchAtom(atom, a);
|
||||||
if (na != NIL) {
|
if (na != NIL) {
|
||||||
READ_UNLOCK(HashChain[hash].AERWLock);
|
READ_UNLOCK(HashChain[hash].AERWLock);
|
||||||
return(na);
|
return(na);
|
||||||
@ -180,7 +180,7 @@ LookupAtom(const char *atom)
|
|||||||
#if defined(YAPOR) || defined(THREADS)
|
#if defined(YAPOR) || defined(THREADS)
|
||||||
if (a != HashChain[hash].Entry) {
|
if (a != HashChain[hash].Entry) {
|
||||||
a = HashChain[hash].Entry;
|
a = HashChain[hash].Entry;
|
||||||
na = SearchAtom((unsigned char *)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);
|
||||||
@ -391,11 +391,11 @@ Yap_LookupAtomWithAddress(const char *atom,
|
|||||||
AtomEntry *ae)
|
AtomEntry *ae)
|
||||||
{ /* lookup atom in atom table */
|
{ /* lookup atom in atom table */
|
||||||
register CELL hash;
|
register CELL hash;
|
||||||
register unsigned char *p;
|
register const char *p;
|
||||||
Atom a;
|
Atom a;
|
||||||
|
|
||||||
/* compute hash */
|
/* compute hash */
|
||||||
p = (unsigned char *)atom;
|
p = atom;
|
||||||
hash = HashFunction(p) % AtomHashTableSize;
|
hash = HashFunction(p) % AtomHashTableSize;
|
||||||
/* ask for a WRITE lock because it is highly unlikely we shall find anything */
|
/* ask for a WRITE lock because it is highly unlikely we shall find anything */
|
||||||
WRITE_LOCK(HashChain[hash].AERWLock);
|
WRITE_LOCK(HashChain[hash].AERWLock);
|
||||||
@ -420,13 +420,13 @@ void
|
|||||||
Yap_ReleaseAtom(Atom atom)
|
Yap_ReleaseAtom(Atom atom)
|
||||||
{ /* Releases an atom from the hash chain */
|
{ /* Releases an atom from the hash chain */
|
||||||
register Int hash;
|
register Int hash;
|
||||||
register unsigned char *p;
|
register const char *p;
|
||||||
AtomEntry *inChain;
|
AtomEntry *inChain;
|
||||||
AtomEntry *ap = RepAtom(atom);
|
AtomEntry *ap = RepAtom(atom);
|
||||||
char *name = ap->StrOfAE;
|
char *name = ap->StrOfAE;
|
||||||
|
|
||||||
/* compute hash */
|
/* compute hash */
|
||||||
p = (unsigned char *)name;
|
p = name;
|
||||||
hash = HashFunction(p) % AtomHashTableSize;
|
hash = HashFunction(p) % AtomHashTableSize;
|
||||||
WRITE_LOCK(HashChain[hash].AERWLock);
|
WRITE_LOCK(HashChain[hash].AERWLock);
|
||||||
if (HashChain[hash].Entry == atom) {
|
if (HashChain[hash].Entry == atom) {
|
||||||
|
Reference in New Issue
Block a user