From 7bcfe636b416610d75b6f8eab38a2dae5d1f9134 Mon Sep 17 00:00:00 2001 From: Terrence Cole Date: Mon, 7 May 2012 12:46:28 -0700 Subject: [PATCH] Bug 752604 - Ergonomics improvements for HashTable::rekeyFront; r=luke --HG-- extra : rebase_source : 9764f2db38844106ac13f5281d85464f0b2aff80 --- js/public/HashTable.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/js/public/HashTable.h b/js/public/HashTable.h index b801e91262f..b50bd07ff00 100644 --- a/js/public/HashTable.h +++ b/js/public/HashTable.h @@ -247,11 +247,12 @@ class HashTable : private AllocPolicy * a new key at the new Lookup position. |front()| is invalid after * this operation until the next call to |popFront()|. */ - void rekeyFront(Key &k) { + void rekeyFront(const Key &k) { JS_ASSERT(&k != &HashPolicy::getKey(this->cur->t)); - JS_ASSERT(!table.match(*this->cur, k)); + if (table.match(*this->cur, k)) + return; Entry e = *this->cur; - HashPolicy::setKey(e.t, k); + HashPolicy::setKey(e.t, const_cast(k)); table.remove(*this->cur); table.add(k, e); added = true;