Skip to content

Commit

Permalink
Fix latest comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Cruceru committed Dec 15, 2020
1 parent d4e3d74 commit a20a198
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions mbedtls/src/rng/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ use crate::error::{Result, IntoResult};
use mbedtls_sys::types::raw_types::{c_int, c_uchar};
use mbedtls_sys::types::size_t;

callback!(EntropyCallbackMut,EntropyCallback:Sync(data: *mut c_uchar, len: size_t) -> c_int);
callback!(RngCallbackMut,RngCallback:Sync(data: *mut c_uchar, len: size_t) -> c_int);
callback!(EntropyCallbackMut,EntropyCallback(data: *mut c_uchar, len: size_t) -> c_int);
callback!(RngCallbackMut,RngCallback(data: *mut c_uchar, len: size_t) -> c_int);

pub trait Random: RngCallback {
fn random(&mut self, data: &mut [u8]) -> Result<()> where Self: Sized {
Expand Down
4 changes: 2 additions & 2 deletions mbedtls/src/rng/os_entropy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ define!(
#[c_ty(entropy_context)]
#[repr(C)]
struct OsEntropy {
sources: Vec<Arc<dyn EntropySourceCallback + Send + Sync + 'static>>,
sources: Vec<Arc<dyn EntropySourceCallback + 'static>>,
};
pub const new: fn() -> Self = entropy_init { sources: Vec::with_capacity(1), };
const drop: fn(&mut Self) = entropy_free;
Expand All @@ -41,7 +41,7 @@ unsafe impl Sync for OsEntropy {}

#[allow(dead_code)]
impl OsEntropy {
pub fn add_source<F: EntropySourceCallback + Send + Sync + 'static>(
pub fn add_source<F: EntropySourceCallback + 'static>(
&mut self,
source: Arc<F>,
threshold: size_t,
Expand Down
14 changes: 7 additions & 7 deletions mbedtls/src/wrapper_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ macro_rules! as_item {
macro_rules! callback {
//{ ($($arg:ident: $ty:ty),*) -> $ret:ty } => {
//};
{ $n:ident, $m:ident$( : $sync:ident )*($($arg:ident: $ty:ty),*) -> $ret:ty } => {
{ $n:ident, $m:ident($($arg:ident: $ty:ty),*) -> $ret:ty } => {
#[cfg(not(feature="threading"))]
pub trait $n {
unsafe extern "C" fn call_mut(user_data: *mut ::mbedtls_sys::types::raw_types::c_void, $($arg:$ty),*) -> $ret where Self: Sized;
Expand All @@ -24,7 +24,7 @@ macro_rules! callback {
}

#[cfg(feature="threading")]
pub trait $n $( : $sync )* {
pub trait $n {
unsafe extern "C" fn call_mut(user_data: *mut ::mbedtls_sys::types::raw_types::c_void, $($arg:$ty),*) -> $ret where Self: Sized;

fn data_ptr_mut(&mut self) -> *mut ::mbedtls_sys::types::raw_types::c_void;
Expand Down Expand Up @@ -60,7 +60,7 @@ macro_rules! callback {
}

#[cfg(feature="threading")]
pub trait $m $( : $sync )* {
pub trait $m {
unsafe extern "C" fn call(user_data: *mut ::mbedtls_sys::types::raw_types::c_void, $($arg:$ty),*) -> $ret where Self: Sized;

fn data_ptr(&self) -> *mut ::mbedtls_sys::types::raw_types::c_void;
Expand Down Expand Up @@ -89,14 +89,14 @@ macro_rules! callback {
}
};
($t:ident: $($bound:tt)*) => {
#[cfg(feature = "threading")]
pub trait $t: $($bound)* {}
#[cfg(not(feature = "threading"))]
pub trait $t: $($bound)* {}
#[cfg(feature = "threading")]
pub trait $t: $($bound)* + Sync {}

#[cfg(feature = "threading")]
impl<F: $($bound)*> $t for F {}
#[cfg(not(feature = "threading"))]
impl<F: $($bound)*> $t for F {}
#[cfg(feature = "threading")]
impl<F: $($bound)* + Sync> $t for F {}
};
}
Expand Down

0 comments on commit a20a198

Please sign in to comment.