Skip to content

Commit 2dba3d0

Browse files
committed
---
yaml --- r: 150972 b: refs/heads/try2 c: ad4062e h: refs/heads/master v: v3
1 parent 5bf2c45 commit 2dba3d0

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 04784540efe156398eee4fba535f5a24b8bd649e
8+
refs/heads/try2: ad4062e8af18b9631291e2c50bf0370ad2768e19
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libcollections/lru_cache.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ pub struct LruCache<K, V> {
5959
map: HashMap<KeyRef<K>, ~LruEntry<K, V>>,
6060
max_size: uint,
6161
head: *mut LruEntry<K, V>,
62-
tail: *mut LruEntry<K, V>,
6362
}
6463

6564
impl<S, K: Hash<S>> Hash<S> for KeyRef<K> {
@@ -103,11 +102,10 @@ impl<K: Hash + TotalEq, V> LruCache<K, V> {
103102
map: HashMap::new(),
104103
max_size: capacity,
105104
head: unsafe{ cast::transmute(~LruEntry::<K, V>::new()) },
106-
tail: unsafe{ cast::transmute(~LruEntry::<K, V>::new()) },
107105
};
108106
unsafe {
109-
(*cache.head).next = cache.tail;
110-
(*cache.tail).prev = cache.head;
107+
(*cache.head).next = cache.head;
108+
(*cache.head).prev = cache.head;
111109
}
112110
return cache;
113111
}
@@ -191,7 +189,7 @@ impl<K: Hash + TotalEq, V> LruCache<K, V> {
191189
#[inline]
192190
fn remove_lru(&mut self) {
193191
if self.len() > 0 {
194-
let lru = unsafe { (*self.tail).prev };
192+
let lru = unsafe { (*self.head).prev };
195193
self.detach(lru);
196194
unsafe {
197195
match (*lru).key {
@@ -269,7 +267,6 @@ impl<K, V> Drop for LruCache<K, V> {
269267
fn drop(&mut self) {
270268
unsafe {
271269
let _: ~LruEntry<K, V> = cast::transmute(self.head);
272-
let _: ~LruEntry<K, V> = cast::transmute(self.tail);
273270
}
274271
}
275272
}

0 commit comments

Comments
 (0)