From: Florian Krohm Date: Wed, 5 Aug 2015 11:26:10 +0000 (+0000) Subject: The number of elements in a hash table cannot be negative. X-Git-Tag: svn/VALGRIND_3_11_0~167 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7bd781160492433ac8afcebfaf5d390343ecddf4;p=thirdparty%2Fvalgrind.git The number of elements in a hash table cannot be negative. Let the return type of VG_(HT_count_nodes) reflect that. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15490 --- diff --git a/coregrind/m_deduppoolalloc.c b/coregrind/m_deduppoolalloc.c index 51a58cb063..d562cc728b 100644 --- a/coregrind/m_deduppoolalloc.c +++ b/coregrind/m_deduppoolalloc.c @@ -201,7 +201,7 @@ static Word cmp_pool_elt (const void* node1, const void* node2 ) static void print_stats (DedupPoolAlloc *ddpa) { VG_(message)(Vg_DebugMsg, - "dedupPA:%s %ld allocs (%d uniq)" + "dedupPA:%s %ld allocs (%u uniq)" " %ld pools (%ld bytes free in last pool)\n", ddpa->cc, (long int) ddpa->nr_alloc_calls, diff --git a/coregrind/m_gdbserver/m_gdbserver.c b/coregrind/m_gdbserver/m_gdbserver.c index fba0a2b18a..87b5b45156 100644 --- a/coregrind/m_gdbserver/m_gdbserver.c +++ b/coregrind/m_gdbserver/m_gdbserver.c @@ -542,7 +542,7 @@ static void clear_gdbserved_addresses(Bool clear_only_jumps) int i; dlog(1, - "clear_gdbserved_addresses: scanning hash table nodes %d\n", + "clear_gdbserved_addresses: scanning hash table nodes %u\n", VG_(HT_count_nodes) (gs_addresses)); ag = (GS_Address**) VG_(HT_to_array) (gs_addresses, &n_elems); for (i = 0; i < n_elems; i++) diff --git a/coregrind/m_hashtable.c b/coregrind/m_hashtable.c index bebcaab616..32219c9560 100644 --- a/coregrind/m_hashtable.c +++ b/coregrind/m_hashtable.c @@ -82,7 +82,7 @@ VgHashTable *VG_(HT_construct) ( const HChar* name ) return table; } -Int VG_(HT_count_nodes) ( const VgHashTable *table ) +UInt VG_(HT_count_nodes) ( const VgHashTable *table ) { return table->n_elements; } diff --git a/helgrind/hg_main.c b/helgrind/hg_main.c index 76650c05e9..10a0e4b5d9 100644 --- a/helgrind/hg_main.c +++ b/helgrind/hg_main.c @@ -5653,7 +5653,7 @@ static void hg_print_stats (void) HG_(stats__LockN_to_P_queries), HG_(stats__LockN_to_P_get_map_size)() ); - VG_(printf)("client malloc-ed blocks: %'8d\n", + VG_(printf)("client malloc-ed blocks: %'8u\n", VG_(HT_count_nodes)(hg_mallocmeta_table)); VG_(printf)("string table map: %'8llu queries (%llu map size)\n", diff --git a/include/pub_tool_hashtable.h b/include/pub_tool_hashtable.h index 6fc6822b46..17060ecfd7 100644 --- a/include/pub_tool_hashtable.h +++ b/include/pub_tool_hashtable.h @@ -58,7 +58,7 @@ typedef struct _VgHashTable VgHashTable; extern VgHashTable *VG_(HT_construct) ( const HChar* name ); /* Count the number of nodes in a table. */ -extern Int VG_(HT_count_nodes) ( const VgHashTable *table ); +extern UInt VG_(HT_count_nodes) ( const VgHashTable *table ); /* Add a node to the table. Duplicate keys are permitted. */ extern void VG_(HT_add_node) ( VgHashTable *t, void* node );