Changed many, but not all, of the VgHashNode* parameters and return
types in m_hashtable.c to void*.  This requires no changes to code
already using VgHashTables, but it allows some previously-required casts
to be removed.  I also changed Memcheck and Massif by removing some of
these now-unnecessary casts.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4404 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_hashtable.c b/coregrind/m_hashtable.c
index 7aef05d..cbb8886 100644
--- a/coregrind/m_hashtable.c
+++ b/coregrind/m_hashtable.c
@@ -40,7 +40,7 @@
 #define CHAIN_NO(key,tbl) (((UWord)(key)) % tbl->n_chains)
 
 struct _VgHashTable {
-   UInt        n_chains;     // should be prime
+   UInt        n_chains;      // should be prime
    VgHashNode* chains[0];
 };
 
@@ -71,8 +71,9 @@
 
 /* Puts a new, heap allocated VgHashNode, into the VgHashTable.  Prepends
    the node to the appropriate chain. */
-void VG_(HT_add_node) ( VgHashTable table, VgHashNode* node )
+void VG_(HT_add_node) ( VgHashTable table, void* vnode )
 {
+   VgHashNode* node     = (VgHashNode*)vnode;
    UInt chain           = CHAIN_NO(node->key, table);
    node->next           = table->chains[chain];
    table->chains[chain] = node;
@@ -81,8 +82,8 @@
 /* Looks up a VgHashNode in the table.  Also returns the address of
    the previous node's 'next' pointer which allows it to be removed from the
    list later without having to look it up again.  */
-VgHashNode* VG_(HT_get_node) ( VgHashTable table, UWord key,
-                               /*OUT*/VgHashNode*** next_ptr )
+void* VG_(HT_get_node) ( VgHashTable table, UWord key,
+                         /*OUT*/VgHashNode*** next_ptr )
 {
    VgHashNode *prev, *curr;
    Int       chain;
@@ -109,7 +110,7 @@
 }
 
 /* Looks up a VgHashNode in the table.  Returns NULL if not found. */
-VgHashNode* VG_(HT_lookup) ( VgHashTable table, UWord key )
+void* VG_(HT_lookup) ( VgHashTable table, UWord key )
 {
    VgHashNode* curr = table->chains[ CHAIN_NO(key, table) ];
 
@@ -123,7 +124,7 @@
 }
 
 /* Removes a VgHashNode from the table.  Returns NULL if not found. */
-VgHashNode* VG_(HT_remove) ( VgHashTable table, UWord key )
+void* VG_(HT_remove) ( VgHashTable table, UWord key )
 {
    Int          chain         = CHAIN_NO(key, table);
    VgHashNode*  curr          =   table->chains[chain];
@@ -173,9 +174,9 @@
 }
 
 /* Return the first VgHashNode satisfying the predicate p. */
-VgHashNode* VG_(HT_first_match) ( VgHashTable table,
-                                  Bool (*p) ( VgHashNode*, void* ),
-                                  void* d )
+void* VG_(HT_first_match) ( VgHashTable table,
+                             Bool (*p) ( VgHashNode*, void* ),
+                             void* d )
 {
    UInt      i;
    VgHashNode* node;
diff --git a/include/pub_tool_hashtable.h b/include/pub_tool_hashtable.h
index ec065f9..165fefd 100644
--- a/include/pub_tool_hashtable.h
+++ b/include/pub_tool_hashtable.h
@@ -59,19 +59,19 @@
 extern Int VG_(HT_count_nodes) ( VgHashTable table );
 
 /* Add a node to the table. */
-extern void VG_(HT_add_node) ( VgHashTable t, VgHashNode* node );
+extern void VG_(HT_add_node) ( VgHashTable t, void* node );
 
 /* Looks up a node in the hash table.  Also returns the address of the
    previous node's `next' pointer which allows it to be removed from the
    list later without having to look it up again.  */
-extern VgHashNode* VG_(HT_get_node) ( VgHashTable t, UWord key,
+extern void* VG_(HT_get_node) ( VgHashTable t, UWord key,
                                     /*OUT*/VgHashNode*** next_ptr );
 
 /* Looks up a VgHashNode in the table.  Returns NULL if not found. */
-extern VgHashNode* VG_(HT_lookup) ( VgHashTable table, UWord key );
+extern void* VG_(HT_lookup) ( VgHashTable table, UWord key );
 
 /* Removes a VgHashNode from the table.  Returns NULL if not found. */
-extern VgHashNode* VG_(HT_remove) ( VgHashTable table, UWord key );
+extern void* VG_(HT_remove) ( VgHashTable table, UWord key );
 
 /* Allocates an array of pointers to all the shadow chunks of malloc'd
    blocks.  Must be freed with VG_(free)(). */
@@ -80,9 +80,9 @@
 /* Returns first node that matches predicate `p', or NULL if none do.
    Extra arguments can be implicitly passed to `p' using `d' which is an
    opaque pointer passed to `p' each time it is called. */
-extern VgHashNode* VG_(HT_first_match) ( VgHashTable t,
-                                         Bool (*p)(VgHashNode*, void*),
-                                         void* d );
+extern void* VG_(HT_first_match) ( VgHashTable t,
+                                   Bool (*p)(VgHashNode*, void*),
+                                   void* d );
 
 /* Applies a function f() once to each node.  Again, `d' can be used
    to pass extra information to the function. */
diff --git a/massif/ms_main.c b/massif/ms_main.c
index bff4de5..7a278ca 100644
--- a/massif/ms_main.c
+++ b/massif/ms_main.c
@@ -690,7 +690,7 @@
       if (0 != size) 
          update_XCon(hc->where, size);
    }
-   VG_(HT_add_node)(malloc_list, (VgHashNode*)hc);
+   VG_(HT_add_node)(malloc_list, hc);
    n_heap_blocks++;
 
    // do a census!
@@ -821,7 +821,7 @@
    // will have removed and then re-added mc unnecessarily.  But that's ok
    // because shrinking a block with realloc() is (presumably) much rarer
    // than growing it, and this way simplifies the growing case.
-   VG_(HT_add_node)(malloc_list, (VgHashNode*)hc);
+   VG_(HT_add_node)(malloc_list, hc);
 
    VGP_POPCC(VgpCliMalloc);
    return p_new;
diff --git a/memcheck/mac_malloc_wrappers.c b/memcheck/mac_malloc_wrappers.c
index de6fac1..92a2947 100644
--- a/memcheck/mac_malloc_wrappers.c
+++ b/memcheck/mac_malloc_wrappers.c
@@ -212,8 +212,7 @@
    // Only update this stat if allocation succeeded.
    cmalloc_bs_mallocd += size;
 
-   VG_(HT_add_node)( table, 
-                     (VgHashNode*)create_MAC_Chunk(tid, p, size, kind) );
+   VG_(HT_add_node)( table, create_MAC_Chunk(tid, p, size, kind) );
 
    MAC_(ban_mem_heap)( p-rzB, rzB );
    MAC_(new_mem_heap)( p, size, is_zeroed );
@@ -417,7 +416,7 @@
    // will have removed and then re-added mc unnecessarily.  But that's ok
    // because shrinking a block with realloc() is (presumably) much rarer
    // than growing it, and this way simplifies the growing case.
-   VG_(HT_add_node)( MAC_(malloc_list), (VgHashNode*)mc );
+   VG_(HT_add_node)( MAC_(malloc_list), mc );
 
    VGP_POPCC(VgpCliMalloc);
    return p_new;
@@ -444,7 +443,7 @@
       VG_(tool_panic)("MAC_(create_mempool): shadow area is accessible");
    } 
 
-   VG_(HT_add_node)( MAC_(mempool_list), (VgHashNode*)mp );
+   VG_(HT_add_node)( MAC_(mempool_list), mp );
    
 }
 
@@ -525,7 +524,8 @@
    }
    MallocStats;
 
-static void malloc_stats_count_chunk(VgHashNode* node, void* d) {
+static void malloc_stats_count_chunk(VgHashNode* node, void* d) 
+{
    MAC_Chunk* mc = (MAC_Chunk*)node;
    MallocStats *ms = (MallocStats *)d;