don't use C++ keywords as variable names
This commit is contained in:
parent
b854138d5f
commit
d12cc63303
@ -323,20 +323,20 @@ struct dn_ht {
|
||||
int ofs; /* offset of link field */
|
||||
uint32_t (*hash)(uintptr_t, int, void *arg);
|
||||
int (*match)(void *_el, uintptr_t key, int, void *);
|
||||
void *(*new)(uintptr_t, int, void *);
|
||||
void *(*newh)(uintptr_t, int, void *);
|
||||
void **ht; /* bucket heads */
|
||||
};
|
||||
/*
|
||||
* Initialize, allocating bucket pointers inline.
|
||||
* Recycle previous record if possible.
|
||||
* If the 'new' function is not supplied, we assume that the
|
||||
* If the 'newh' function is not supplied, we assume that the
|
||||
* key passed to ht_find is the same object to be stored in.
|
||||
*/
|
||||
struct dn_ht *
|
||||
dn_ht_init(struct dn_ht *ht, int buckets, int ofs,
|
||||
uint32_t (*h)(uintptr_t, int, void *),
|
||||
int (*match)(void *, uintptr_t, int, void *),
|
||||
void *(*new)(uintptr_t, int, void *))
|
||||
void *(*newh)(uintptr_t, int, void *))
|
||||
{
|
||||
int l;
|
||||
|
||||
@ -410,7 +410,7 @@ dn_ht_init(struct dn_ht *ht, int buckets, int ofs,
|
||||
ht->ofs = ofs;
|
||||
ht->hash = h;
|
||||
ht->match = match;
|
||||
ht->new = new;
|
||||
ht->newh = newh;
|
||||
}
|
||||
return ht;
|
||||
}
|
||||
@ -471,8 +471,8 @@ dn_ht_find(struct dn_ht *ht, uintptr_t key, int flags, void *arg)
|
||||
} else if (flags & DNHT_INSERT) {
|
||||
// printf("%s before calling new, bucket %d ofs %d\n",
|
||||
// __FUNCTION__, i, ht->ofs);
|
||||
p = ht->new ? ht->new(key, flags, arg) : (void *)key;
|
||||
// printf("%s new returns %p\n", __FUNCTION__, p);
|
||||
p = ht->newh ? ht->newh(key, flags, arg) : (void *)key;
|
||||
// printf("%s newh returns %p\n", __FUNCTION__, p);
|
||||
if (p) {
|
||||
ht->entries++;
|
||||
*(void **)((char *)p + ht->ofs) = ht->ht[i];
|
||||
|
@ -119,7 +119,7 @@ int heap_scan(struct dn_heap *, int (*)(void *, uintptr_t), uintptr_t);
|
||||
* hash(key, flags, arg) called to return a bucket index.
|
||||
* match(obj, key, flags, arg) called to determine if key
|
||||
* matches the current 'obj' in the heap
|
||||
* new(key, flags, arg) optional, used to allocate a new
|
||||
* newh(key, flags, arg) optional, used to allocate a new
|
||||
* object during insertions.
|
||||
*
|
||||
* dn_ht_free() frees the heap or unlink elements.
|
||||
@ -167,7 +167,7 @@ struct dn_ht; /* should be opaque */
|
||||
struct dn_ht *dn_ht_init(struct dn_ht *, int buckets, int ofs,
|
||||
uint32_t (*hash)(uintptr_t, int, void *),
|
||||
int (*match)(void *, uintptr_t, int, void *),
|
||||
void *(*new)(uintptr_t, int, void *));
|
||||
void *(*newh)(uintptr_t, int, void *));
|
||||
void dn_ht_free(struct dn_ht *, int flags);
|
||||
|
||||
void *dn_ht_find(struct dn_ht *, uintptr_t, int, void *);
|
||||
|
Loading…
x
Reference in New Issue
Block a user