Remove useless arguments in sparsewa, that were inheritated from WordFM
These arguments are not needed for sparsewa, as they can only
return the key given in input.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15083 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_sparsewa.c b/coregrind/m_sparsewa.c
index 94a3cec..3f111c4 100644
--- a/coregrind/m_sparsewa.c
+++ b/coregrind/m_sparsewa.c
@@ -274,7 +274,7 @@
Bool VG_(lookupSWA) ( const SparseWA* swa,
- /*OUT*/UWord* keyP, /*OUT*/UWord* valP,
+ /*OUT*/UWord* valP,
UWord key )
{
Int i;
@@ -302,7 +302,6 @@
vg_assert(level0->nInUse > 0);
ix = key & 0xFF;
if (swa_bitarray_read(level0->inUse, ix) == 0) return False;
- *keyP = key; /* this is stupid. only here to make it look like WordFM */
*valP = level0->words[ix];
return True;
}
@@ -366,7 +365,7 @@
Bool VG_(delFromSWA) ( SparseWA* swa,
- /*OUT*/UWord* oldK, /*OUT*/UWord* oldV, UWord key )
+ /*OUT*/UWord* oldV, UWord key )
{
Int i;
UWord ix;
@@ -403,7 +402,6 @@
if (swa_bitarray_read_then_clear(level0->inUse, ix) == 0)
return False;
- *oldK = key; /* this is silly */
*oldV = level0->words[ix];
level0->nInUse--;
diff --git a/helgrind/libhb_core.c b/helgrind/libhb_core.c
index 1bd771d..b9c8064 100644
--- a/helgrind/libhb_core.c
+++ b/helgrind/libhb_core.c
@@ -4149,7 +4149,7 @@
OldRef* ref;
RCEC* rcec;
Word i, j;
- UWord keyW, valW;
+ UWord valW;
Bool b;
tl_assert(thr);
@@ -4173,14 +4173,13 @@
/* Look in the map to see if we already have a record for this
address. */
- b = VG_(lookupSWA)( oldrefTree, &keyW, &valW, a );
+ b = VG_(lookupSWA)( oldrefTree, &valW, a );
if (b) {
/* We already have a record for this address. We now need to
see if we have a stack trace pertaining to this (thrid, R/W,
size) triple. */
- tl_assert(keyW == a);
ref = (OldRef*)valW;
tl_assert(ref->magic == OldRef_MAGIC);
@@ -4287,7 +4286,7 @@
{
Word i, j;
OldRef* ref;
- UWord keyW, valW;
+ UWord valW;
Bool b;
ThrID cand_thrid;
@@ -4319,12 +4318,11 @@
cand_a = toCheck[j];
// VG_(printf)("test %ld %p\n", j, cand_a);
- b = VG_(lookupSWA)( oldrefTree, &keyW, &valW, cand_a );
+ b = VG_(lookupSWA)( oldrefTree, &valW, cand_a );
if (!b)
continue;
ref = (OldRef*)valW;
- tl_assert(keyW == cand_a);
tl_assert(ref->magic == OldRef_MAGIC);
tl_assert(ref->accs[0].thrid != 0); /* first slot must always be used */
@@ -4705,9 +4703,8 @@
for (i = 0; i < n2del; i++) {
Bool b;
Addr ga2del = *(Addr*)VG_(indexXA)( refs2del, i );
- b = VG_(delFromSWA)( oldrefTree, &keyW, &valW, ga2del );
+ b = VG_(delFromSWA)( oldrefTree, &valW, ga2del );
tl_assert(b);
- tl_assert(keyW == ga2del);
oldref = (OldRef*)valW;
for (j = 0; j < N_OLDREF_ACCS; j++) {
ThrID aThrID = oldref->accs[j].thrid;
diff --git a/include/pub_tool_sparsewa.h b/include/pub_tool_sparsewa.h
index f56e631..8e1644d 100644
--- a/include/pub_tool_sparsewa.h
+++ b/include/pub_tool_sparsewa.h
@@ -63,21 +63,17 @@
// overwritten. Returned Bool is True iff a previous binding existed.
Bool VG_(addToSWA) ( SparseWA* swa, UWord key, UWord val );
-// Delete key from swa, returning associated key and val if found.
-// Note: returning associated key is stupid (it can only be the
-// key you just specified). This behaviour is retained to make it
-// easier to migrate from WordFM. Returned Bool is True iff
-// the key was actually bound in the mapping.
+// Delete key from swa, returning val if found.
+// Returned Bool is True iff the key was actually bound in the mapping.
Bool VG_(delFromSWA) ( SparseWA* swa,
- /*OUT*/UWord* oldK, /*OUT*/UWord* oldV,
+ /*OUT*/UWord* oldV,
UWord key );
// Indexes swa at 'key' (or, if you like, looks up 'key' in the
-// mapping), and returns the associated value, if any, in *valP. For
-// compatibility with WordFM, 'key' is also returned in *keyP. Returned
-// Bool is True iff a binding for 'key' actually existed.
+// mapping), and returns the associated value, if any, in *valP.
+// Returned Bool is True iff a binding for 'key' actually existed.
Bool VG_(lookupSWA) ( const SparseWA* swa,
- /*OUT*/UWord* keyP, /*OUT*/UWord* valP,
+ /*OUT*/UWord* valP,
UWord key );
// Set up 'swa' for iteration.