Patch from Bart Van Assche <bart.vanassche@gmail.com>.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7308
} LineCC;
// First compare file, then fn, then line.
-static Word cmp_CodeLoc_LineCC(void *vloc, void *vcc)
+static Word cmp_CodeLoc_LineCC(const void *vloc, const void *vcc)
{
Word res;
CodeLoc* a = (CodeLoc*)vloc;
/*--- String table operations ---*/
/*------------------------------------------------------------*/
-static Word stringCmp( void* key, void* elem )
+static Word stringCmp( const void* key, const void* elem )
{
return VG_(strcmp)(*(Char**)key, *(Char**)elem);
}
}
// Compare a key and an element. Inlining is *crucial*.
-static inline Word slow_cmp(AvlTree* t, void* k, AvlNode* n)
+static inline Word slow_cmp(const AvlTree* t, const void* k, const AvlNode* n)
{
return t->cmp(k, elem_of_node(n));
}
/*--------------------------------------------------------------------*/
// Find the *node* in t matching k, or NULL if not found.
-static AvlNode* avl_lookup(AvlTree* t, void* k)
+static AvlNode* avl_lookup(const AvlTree* t, const void* k)
{
Word cmpres;
AvlNode* curr = t->root;
}
// Find the *element* in t matching k, or NULL if not found.
-void* VG_(OSetGen_Lookup)(AvlTree* t, void* k)
+void* VG_(OSetGen_Lookup)(const AvlTree* t, const void* k)
{
AvlNode* n;
vg_assert(t);
// Find the *element* in t matching k, or NULL if not found; use the given
// comparison function rather than the standard one.
-void* VG_(OSetGen_LookupWithCmp)(AvlTree* t, void* k, OSetCmp_t cmp)
+void* VG_(OSetGen_LookupWithCmp)(AvlTree* t, const void* k, OSetCmp_t cmp)
{
// Save the normal one to the side, then restore once we're done.
void* e;
}
// Is there an element matching k?
-Bool VG_(OSetGen_Contains)(AvlTree* t, void* k)
+Bool VG_(OSetGen_Contains)(const AvlTree* t, const void* k)
{
return (NULL != VG_(OSetGen_Lookup)(t, k));
}
/*--- Miscellaneous operations ---*/
/*--------------------------------------------------------------------*/
-Int VG_(OSetGen_Size)(AvlTree* t)
+Int VG_(OSetGen_Size)(const AvlTree* t)
{
vg_assert(t);
return t->nElems;
// - Alloc: allocates a chunk of memory.
// - Free: frees a chunk of memory allocated with Alloc.
-typedef Word (*OSetCmp_t) ( void* key, void* elem );
+typedef Word (*OSetCmp_t) ( const void* key, const void* elem );
typedef void* (*OSetAlloc_t) ( SizeT szB );
typedef void (*OSetFree_t) ( void* p );
// they will return NULL if VG_(OSetGen_Next)() is called without an
// intervening call to VG_(OSetGen_ResetIter)().
-extern Int VG_(OSetGen_Size) ( OSet* os );
+extern Int VG_(OSetGen_Size) ( const OSet* os );
extern void VG_(OSetGen_Insert) ( OSet* os, void* elem );
-extern Bool VG_(OSetGen_Contains) ( OSet* os, void* key );
-extern void* VG_(OSetGen_Lookup) ( OSet* os, void* key );
-extern void* VG_(OSetGen_LookupWithCmp)( OSet* os, void* key, OSetCmp_t cmp );
+extern Bool VG_(OSetGen_Contains) ( const OSet* os, const void* key );
+extern void* VG_(OSetGen_Lookup) ( const OSet* os, const void* key );
+extern void* VG_(OSetGen_LookupWithCmp)( OSet* os, const void* key, OSetCmp_t cmp );
extern void* VG_(OSetGen_Remove) ( OSet* os, void* key );
extern void VG_(OSetGen_ResetIter) ( OSet* os );
extern void* VG_(OSetGen_Next) ( OSet* os );