mirror of
https://github.com/NotAShelf/stash.git
synced 2026-05-09 17:05:12 +00:00
db: replace \CHECKED\ atomic flag with pattern-keyed regex cache
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I9d5fa5212c5418ce6bca02d05149e1356a6a6964
This commit is contained in:
parent
373affabee
commit
b1f43bdf7f
5 changed files with 106 additions and 39 deletions
|
|
@ -412,7 +412,7 @@ impl SqliteClipboardDb {
|
|||
},
|
||||
(KeyCode::Enter, _) => actions.copy = true,
|
||||
(KeyCode::Char('D'), KeyModifiers::SHIFT) => {
|
||||
actions.delete = true
|
||||
actions.delete = true;
|
||||
},
|
||||
(KeyCode::Char('/'), _) => actions.toggle_search = true,
|
||||
_ => {},
|
||||
|
|
@ -697,7 +697,7 @@ impl SqliteClipboardDb {
|
|||
let opts = Options::new();
|
||||
let mime_type = match mime {
|
||||
Some(ref m) if m == "text/plain" => MimeType::Text,
|
||||
Some(ref m) => MimeType::Specific(m.clone().to_owned()),
|
||||
Some(ref m) => MimeType::Specific(m.clone().clone()),
|
||||
None => MimeType::Text,
|
||||
};
|
||||
let copy_result = opts
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use std::{collections::BinaryHeap, io::Read, time::Duration};
|
||||
|
||||
/// FNV-1a hasher for deterministic hashing across process runs.
|
||||
/// Unlike DefaultHasher (SipHash), this produces stable hashes.
|
||||
/// Unlike `DefaultHasher` (`SipHash`), this produces stable hashes.
|
||||
struct Fnv1aHasher {
|
||||
state: u64,
|
||||
}
|
||||
|
|
@ -18,7 +18,7 @@ impl Fnv1aHasher {
|
|||
|
||||
fn write(&mut self, bytes: &[u8]) {
|
||||
for byte in bytes {
|
||||
self.state ^= *byte as u64;
|
||||
self.state ^= u64::from(*byte);
|
||||
self.state = self.state.wrapping_mul(Self::FNV_PRIME);
|
||||
}
|
||||
}
|
||||
|
|
@ -82,7 +82,7 @@ impl std::cmp::Ord for Neg {
|
|||
}
|
||||
|
||||
/// Min-heap for tracking entry expirations with sub-second precision.
|
||||
/// Uses Neg wrapper to turn BinaryHeap (max-heap) into min-heap behavior.
|
||||
/// Uses Neg wrapper to turn `BinaryHeap` (max-heap) into min-heap behavior.
|
||||
#[derive(Debug, Default)]
|
||||
struct ExpirationQueue {
|
||||
heap: BinaryHeap<(Neg, i64)>,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue