X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fhash.c;h=61c369a80cdada0d2fc67562875942a5fd92e877;hb=f7fa946d1da96178e63e42dd8d8739d3e0f66e1d;hp=b624e6ecac1537ed8851d83b8081eeab04f5bf2d;hpb=e5c7d1e1c8ccb493c63e33d017c28b5cf4a55829;p=mesa.git diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c index b624e6ecac1..61c369a80cd 100644 --- a/src/mesa/main/hash.c +++ b/src/mesa/main/hash.c @@ -123,7 +123,7 @@ _mesa_DeleteHashTable(struct _mesa_HashTable *table) * Lookup an entry in the hash table, without locking. * \sa _mesa_HashLookup */ -static INLINE void * +static inline void * _mesa_HashLookup_unlocked(struct _mesa_HashTable *table, GLuint key) { GLuint pos; @@ -277,7 +277,7 @@ _mesa_HashRemove(struct _mesa_HashTable *table, GLuint key) * \param table the hash table to delete * \param callback the callback function * \param userData arbitrary pointer to pass along to the callback - * (this is typically a GLcontext pointer) + * (this is typically a struct gl_context pointer) */ void _mesa_HashDeleteAll(struct _mesa_HashTable *table, @@ -313,7 +313,7 @@ _mesa_HashDeleteAll(struct _mesa_HashTable *table, * \param table the hash table to walk * \param callback the callback function * \param userData arbitrary pointer to pass along to the callback - * (this is typically a GLcontext pointer) + * (this is typically a struct gl_context pointer) */ void _mesa_HashWalk(const struct _mesa_HashTable *table, @@ -480,6 +480,26 @@ _mesa_HashFindFreeKeyBlock(struct _mesa_HashTable *table, GLuint numKeys) } +/** + * Return the number of entries in the hash table. + */ +GLuint +_mesa_HashNumEntries(const struct _mesa_HashTable *table) +{ + GLuint pos, count = 0; + + for (pos = 0; pos < TABLE_SIZE; pos++) { + const struct HashEntry *entry; + for (entry = table->Table[pos]; entry; entry = entry->Next) { + count++; + } + } + + return count; +} + + + #if 0 /* debug only */ /**