Skip to content

Commit

Permalink
secret: Allocate bufer only once
Browse files Browse the repository at this point in the history
gnome-keyring will always pass 64 bytes so we allocated only once. If
other implementations require:

 - less: Then we still allocate fewer times, and extra bytes do not harm
 - more: Then we still allocate fewer times than before
  • Loading branch information
A6GibKm authored and bilelmoussaoui committed Oct 31, 2024
1 parent c5627f6 commit c14a742
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/desktop/secret.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl<'a> std::ops::Deref for Secret<'a> {
/// It crates a UnixStream internally for receiving the secret.
pub async fn retrieve() -> Result<Vec<u8>, Error> {
let proxy = Secret::new().await?;
let mut buf = Vec::new();
let mut buf = Vec::with_capacity(64);

#[cfg(feature = "tokio")]
let mut x1 = {
Expand Down

0 comments on commit c14a742

Please sign in to comment.