forked from M-Labs/artiq
parent
829fca6112
commit
5871d13da8
@ -212,14 +212,19 @@ mod imp {
|
||||
// so it does not really matter.
|
||||
let mut offset = 0;
|
||||
let mut iter = Iter::new(old_data);
|
||||
while let Some(result) = iter.next() {
|
||||
'iter: while let Some(result) = iter.next() {
|
||||
let (key, mut value) = result?;
|
||||
if value.is_empty() {
|
||||
// This is a removed entry, ignore it.
|
||||
continue
|
||||
}
|
||||
|
||||
let mut next_iter = iter.clone();
|
||||
while let Some(next_result) = next_iter.next() {
|
||||
let (next_key, next_value) = next_result?;
|
||||
let (next_key, _) = next_result?;
|
||||
if key == next_key {
|
||||
value = next_value
|
||||
// There's another entry that overwrites this one, ignore this one.
|
||||
continue 'iter
|
||||
}
|
||||
}
|
||||
offset = unsafe { append_at(data, offset, key, value)? };
|
||||
|
Loading…
Reference in New Issue
Block a user