Mercurial > lbo > hg > leveldb-rs
changeset 342:b9cb08d20191
skipmap: clean-up in valid() code
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Wed, 04 Oct 2017 20:02:20 +0200 |
parents | 5a266a55f459 |
children | df206c176f83 |
files | src/skipmap.rs |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/skipmap.rs Wed Oct 04 19:59:43 2017 +0200 +++ b/src/skipmap.rs Wed Oct 04 20:02:20 2017 +0200 @@ -141,7 +141,7 @@ } unsafe { - if current.is_null() || (*current).key.is_empty() { + if current.is_null() || current == self.head.as_ref() { return None; } else if self.cmp.cmp(&(*current).key, key) == Ordering::Less { return None; @@ -179,7 +179,7 @@ } unsafe { - if current.is_null() || (*current).key.is_empty() { + if current.is_null() || current == self.head.as_ref() { // If we're past the end for some reason or at the head return None; } else if self.cmp.cmp(&(*current).key, key) != Ordering::Less { @@ -315,7 +315,7 @@ self.reset(); } fn valid(&self) -> bool { - unsafe { !(*self.current).key.is_empty() } + self.current != self.map.borrow().head.as_ref() } fn current(&self, key: &mut Vec<u8>, val: &mut Vec<u8>) -> bool { if self.valid() {