use const wherever possible
This commit is contained in:
parent
a719c19d03
commit
6b409a55a6
28
C/adtdefs.c
28
C/adtdefs.c
@ -109,7 +109,7 @@ Yap_MkFunctorWithAddress(Atom ap, unsigned int arity, FunctorEntry *p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline static Atom
|
inline static Atom
|
||||||
SearchInInvisible(char *atom)
|
SearchInInvisible(const char *atom)
|
||||||
{
|
{
|
||||||
AtomEntry *chain;
|
AtomEntry *chain;
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ SearchAtom(unsigned char *p, Atom a) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline Atom
|
static inline Atom
|
||||||
SearchWideAtom(wchar_t *p, Atom a) {
|
SearchWideAtom(const wchar_t *p, Atom a) {
|
||||||
AtomEntry *ae;
|
AtomEntry *ae;
|
||||||
|
|
||||||
/* search atom in chain */
|
/* search atom in chain */
|
||||||
@ -156,7 +156,7 @@ SearchWideAtom(wchar_t *p, Atom a) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Atom
|
static Atom
|
||||||
LookupAtom(char *atom)
|
LookupAtom(const char *atom)
|
||||||
{ /* lookup atom in atom table */
|
{ /* lookup atom in atom table */
|
||||||
UInt hash;
|
UInt hash;
|
||||||
unsigned char *p;
|
unsigned char *p;
|
||||||
@ -216,7 +216,7 @@ LookupAtom(char *atom)
|
|||||||
|
|
||||||
|
|
||||||
static Atom
|
static Atom
|
||||||
LookupWideAtom(wchar_t *atom)
|
LookupWideAtom(const wchar_t *atom)
|
||||||
{ /* lookup atom in atom table */
|
{ /* lookup atom in atom table */
|
||||||
CELL hash;
|
CELL hash;
|
||||||
wchar_t *p;
|
wchar_t *p;
|
||||||
@ -226,7 +226,7 @@ LookupWideAtom(wchar_t *atom)
|
|||||||
WideAtomEntry *wae;
|
WideAtomEntry *wae;
|
||||||
|
|
||||||
/* compute hash */
|
/* compute hash */
|
||||||
p = atom;
|
p = (wchar_t *)atom;
|
||||||
hash = WideHashFunction(p) % WideAtomHashTableSize;
|
hash = WideHashFunction(p) % WideAtomHashTableSize;
|
||||||
/* 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(WideHashChain[hash].AERWLock);
|
READ_LOCK(WideHashChain[hash].AERWLock);
|
||||||
@ -285,9 +285,9 @@ LookupWideAtom(wchar_t *atom)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Atom
|
Atom
|
||||||
Yap_LookupMaybeWideAtom(wchar_t *atom)
|
Yap_LookupMaybeWideAtom(const wchar_t *atom)
|
||||||
{ /* lookup atom in atom table */
|
{ /* lookup atom in atom table */
|
||||||
wchar_t *p = atom, c;
|
wchar_t *p = (wchar_t *)atom, c;
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
char *ptr, *ptr0;
|
char *ptr, *ptr0;
|
||||||
Atom at;
|
Atom at;
|
||||||
@ -297,7 +297,7 @@ Yap_LookupMaybeWideAtom(wchar_t *atom)
|
|||||||
len++;
|
len++;
|
||||||
}
|
}
|
||||||
/* not really a wide atom */
|
/* not really a wide atom */
|
||||||
p = atom;
|
p = (wchar_t *)atom;
|
||||||
ptr0 = ptr = Yap_AllocCodeSpace(len+1);
|
ptr0 = ptr = Yap_AllocCodeSpace(len+1);
|
||||||
if (!ptr)
|
if (!ptr)
|
||||||
return NIL;
|
return NIL;
|
||||||
@ -308,7 +308,7 @@ Yap_LookupMaybeWideAtom(wchar_t *atom)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Atom
|
Atom
|
||||||
Yap_LookupMaybeWideAtomWithLength(wchar_t *atom, size_t len0)
|
Yap_LookupMaybeWideAtomWithLength(const wchar_t *atom, size_t len0)
|
||||||
{ /* lookup atom in atom table */
|
{ /* lookup atom in atom table */
|
||||||
Atom at;
|
Atom at;
|
||||||
int wide = FALSE;
|
int wide = FALSE;
|
||||||
@ -354,7 +354,7 @@ Yap_LookupMaybeWideAtomWithLength(wchar_t *atom, size_t len0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Atom
|
Atom
|
||||||
Yap_LookupAtomWithLength(char *atom, size_t len0)
|
Yap_LookupAtomWithLength(const char *atom, size_t len0)
|
||||||
{ /* lookup atom in atom table */
|
{ /* lookup atom in atom table */
|
||||||
Atom at;
|
Atom at;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
@ -371,19 +371,19 @@ Yap_LookupAtomWithLength(char *atom, size_t len0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Atom
|
Atom
|
||||||
Yap_LookupAtom(char *atom)
|
Yap_LookupAtom(const char *atom)
|
||||||
{ /* lookup atom in atom table */
|
{ /* lookup atom in atom table */
|
||||||
return LookupAtom(atom);
|
return LookupAtom(atom);
|
||||||
}
|
}
|
||||||
|
|
||||||
Atom
|
Atom
|
||||||
Yap_LookupWideAtom(wchar_t *atom)
|
Yap_LookupWideAtom(const wchar_t *atom)
|
||||||
{ /* lookup atom in atom table */
|
{ /* lookup atom in atom table */
|
||||||
return LookupWideAtom(atom);
|
return LookupWideAtom(atom);
|
||||||
}
|
}
|
||||||
|
|
||||||
Atom
|
Atom
|
||||||
Yap_FullLookupAtom(char *atom)
|
Yap_FullLookupAtom(const char *atom)
|
||||||
{ /* lookup atom in atom table */
|
{ /* lookup atom in atom table */
|
||||||
Atom t;
|
Atom t;
|
||||||
|
|
||||||
@ -394,7 +394,7 @@ Yap_FullLookupAtom(char *atom)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Yap_LookupAtomWithAddress(char *atom, AtomEntry *ae)
|
Yap_LookupAtomWithAddress(const char *atom, AtomEntry *ae)
|
||||||
{ /* lookup atom in atom table */
|
{ /* lookup atom in atom table */
|
||||||
register CELL hash;
|
register CELL hash;
|
||||||
register unsigned char *p;
|
register unsigned char *p;
|
||||||
|
Reference in New Issue
Block a user