Switch boring from lazy_static to once_cell
This commit is contained in:
parent
af5bb39a78
commit
abfe2f7980
|
|
@ -23,7 +23,6 @@ fs_extra = "1.3.0"
|
|||
fslock = "0.2"
|
||||
bitflags = "1.0"
|
||||
foreign-types = "0.5"
|
||||
lazy_static = "1"
|
||||
libc = "0.2"
|
||||
hex = "0.4"
|
||||
rusty-hook = "^0.11"
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ pq-experimental = ["boring-sys/pq-experimental"]
|
|||
[dependencies]
|
||||
bitflags = { workspace = true }
|
||||
foreign-types = { workspace = true }
|
||||
lazy_static = { workspace = true }
|
||||
once_cell = { workspace = true }
|
||||
libc = { workspace = true }
|
||||
boring-sys = { workspace = true }
|
||||
|
||||
|
|
|
|||
|
|
@ -81,8 +81,6 @@
|
|||
extern crate bitflags;
|
||||
#[macro_use]
|
||||
extern crate foreign_types;
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
extern crate boring_sys as ffi;
|
||||
extern crate libc;
|
||||
|
||||
|
|
|
|||
|
|
@ -66,10 +66,10 @@ where
|
|||
|
||||
let ssl = unsafe { SslRef::from_ptr_mut(ssl_ptr) };
|
||||
|
||||
let hint = if !hint.is_null() {
|
||||
Some(unsafe { CStr::from_ptr(hint) }.to_bytes())
|
||||
} else {
|
||||
let hint = if hint.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(unsafe { CStr::from_ptr(hint) }.to_bytes())
|
||||
};
|
||||
|
||||
// Give the callback mutable slices into which it can write the identity and psk.
|
||||
|
|
@ -107,10 +107,10 @@ where
|
|||
|
||||
let ssl = unsafe { SslRef::from_ptr_mut(ssl) };
|
||||
|
||||
let identity = if !identity.is_null() {
|
||||
Some(unsafe { CStr::from_ptr(identity) }.to_bytes())
|
||||
} else {
|
||||
let identity = if identity.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(unsafe { CStr::from_ptr(identity) }.to_bytes())
|
||||
};
|
||||
|
||||
// Give the callback mutable slices into which it can write the psk.
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@
|
|||
use crate::ffi;
|
||||
use foreign_types::{ForeignType, ForeignTypeRef, Opaque};
|
||||
use libc::{c_char, c_int, c_long, c_uchar, c_uint, c_void};
|
||||
use once_cell::sync::Lazy;
|
||||
use std::any::TypeId;
|
||||
use std::cmp;
|
||||
use std::collections::HashMap;
|
||||
|
|
@ -413,16 +414,12 @@ impl NameType {
|
|||
}
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
static ref INDEXES: Mutex<HashMap<TypeId, c_int>> = Mutex::new(HashMap::new());
|
||||
static ref SSL_INDEXES: Mutex<HashMap<TypeId, c_int>> = Mutex::new(HashMap::new());
|
||||
static ref SESSION_CTX_INDEX: Index<Ssl, SslContext> = Ssl::new_ex_index().unwrap();
|
||||
}
|
||||
|
||||
static INDEXES: Lazy<Mutex<HashMap<TypeId, c_int>>> = Lazy::new(|| Mutex::new(HashMap::new()));
|
||||
static SSL_INDEXES: Lazy<Mutex<HashMap<TypeId, c_int>>> = Lazy::new(|| Mutex::new(HashMap::new()));
|
||||
static SESSION_CTX_INDEX: Lazy<Index<Ssl, SslContext>> = Lazy::new(|| Ssl::new_ex_index().unwrap());
|
||||
#[cfg(feature = "rpk")]
|
||||
lazy_static! {
|
||||
static ref RPK_FLAG_INDEX: Index<SslContext, bool> = SslContext::new_ex_index().unwrap();
|
||||
}
|
||||
static RPK_FLAG_INDEX: Lazy<Index<SslContext, bool>> =
|
||||
Lazy::new(|| SslContext::new_ex_index().unwrap());
|
||||
|
||||
unsafe extern "C" fn free_data_box<T>(
|
||||
_parent: *mut c_void,
|
||||
|
|
|
|||
Loading…
Reference in New Issue