mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-03 10:05:29 +00:00
Also compare keys before calling cmp in the hash table stats printing
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15268
This commit is contained in:
parent
cd8086c31a
commit
d117a8d8b0
@ -278,22 +278,18 @@ void VG_(HT_print_stats) ( const VgHashTable *table, HT_Cmp_t cmp )
|
||||
nelt = 0;
|
||||
// Is the same cnode element existing before cnode ?
|
||||
for (node = table->chains[i]; node != cnode; node = node->next) {
|
||||
if (cmp) {
|
||||
if ((*cmp)(node, cnode) == 0)
|
||||
nelt++;
|
||||
} else
|
||||
if (node->key == cnode->key)
|
||||
nelt++;
|
||||
if (node->key == cnode->key
|
||||
&& (cmp == NULL || cmp (node, cnode) == 0)) {
|
||||
nelt++;
|
||||
}
|
||||
}
|
||||
// If cnode element not in a previous node, count occurences of elt.
|
||||
if (nelt == 0) {
|
||||
for (node = cnode; node != NULL; node = node->next) {
|
||||
if (cmp) {
|
||||
if ((*cmp)(node, cnode) == 0)
|
||||
nelt++;
|
||||
} else
|
||||
if (node->key == cnode->key)
|
||||
nelt++;
|
||||
if (node->key == cnode->key
|
||||
&& (cmp == NULL || cmp (node, cnode) == 0)) {
|
||||
nelt++;
|
||||
}
|
||||
}
|
||||
INCOCCUR(elt_occurences, nelt);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user