Commit 0bae121e authored by Paul Florence's avatar Paul Florence
Browse files

Added a macro that wraps foreign type, and impl Send and Sync for both,

the borrowed type and the owned one.
Replaced all invocation of `foreign_type` by `foreign_type_and_impl_send_sync`.
parent 65c1c4e0
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ use error::ErrorStack;
use nid::Nid;
use string::OpensslString;

foreign_type! {
foreign_type_and_impl_send_sync! {
    type CType = ffi::ASN1_GENERALIZEDTIME;
    fn drop = ffi::ASN1_GENERALIZEDTIME_free;

@@ -73,7 +73,7 @@ impl fmt::Display for Asn1GeneralizedTimeRef {
    }
}

foreign_type! {
foreign_type_and_impl_send_sync! {
    type CType = ffi::ASN1_TIME;
    fn drop = ffi::ASN1_TIME_free;
    /// Time storage and comparison
@@ -119,7 +119,7 @@ impl Asn1Time {
    }
}

foreign_type! {
foreign_type_and_impl_send_sync! {
    type CType = ffi::ASN1_STRING;
    fn drop = ffi::ASN1_STRING_free;
    /// Primary ASN.1 type used by OpenSSL
@@ -170,7 +170,7 @@ impl Asn1StringRef {
    }
}

foreign_type! {
foreign_type_and_impl_send_sync! {
    type CType = ffi::ASN1_INTEGER;
    fn drop = ffi::ASN1_INTEGER_free;

@@ -211,7 +211,7 @@ impl Asn1IntegerRef {
    }
}

foreign_type! {
foreign_type_and_impl_send_sync! {
    type CType = ffi::ASN1_BIT_STRING;
    fn drop = ffi::ASN1_BIT_STRING_free;
    /// Sequence of bytes
@@ -238,7 +238,7 @@ impl Asn1BitStringRef {
    }
}

foreign_type! {
foreign_type_and_impl_send_sync! {
    type CType = ffi::ASN1_OBJECT;
    fn drop = ffi::ASN1_OBJECT_free;

+2 −2
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ pub const MSB_ONE: MsbOption = MsbOption(0);
/// of bits in the original numbers.
pub const TWO_MSB_ONE: MsbOption = MsbOption(1);

foreign_type! {
foreign_type_and_impl_send_sync! {
    type CType = ffi::BN_CTX;
    fn drop = ffi::BN_CTX_free;

@@ -99,7 +99,7 @@ impl BigNumContext {
    }
}

foreign_type! {
foreign_type_and_impl_send_sync! {
    type CType = ffi::BIGNUM;
    fn drop = ffi::BN_free;

+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ use pkey::PKeyRef;
use cvt;
use cvt_p;

foreign_type! {
foreign_type_and_impl_send_sync! {
    type CType = ffi::CMS_ContentInfo;
    fn drop = ffi::CMS_ContentInfo_free;

+1 −1
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ impl ConfMethod {
    }
}

foreign_type! {
foreign_type_and_impl_send_sync! {
    type CType = ffi::CONF;
    fn drop = ffi::NCONF_free;

+1 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ use std::ptr;
use {cvt, cvt_p};
use bn::BigNum;

foreign_type! {
foreign_type_and_impl_send_sync! {
    type CType = ffi::DH;
    fn drop = ffi::DH_free;

Loading