diff options
| author | Steven Fackler <[email protected]> | 2016-10-26 21:55:13 -0700 |
|---|---|---|
| committer | Steven Fackler <[email protected]> | 2016-10-26 21:55:13 -0700 |
| commit | 548c8b5fbaca291237e22b8959c05769a884b08c (patch) | |
| tree | 13418e4b11c05fb864910b5bc1c1129c76f36c67 /openssl/src/crypto.rs | |
| parent | Don't double-allocate strings (diff) | |
| download | rust-openssl-548c8b5fbaca291237e22b8959c05769a884b08c.tar.xz rust-openssl-548c8b5fbaca291237e22b8959c05769a884b08c.zip | |
Remove macros module
Diffstat (limited to 'openssl/src/crypto.rs')
| -rw-r--r-- | openssl/src/crypto.rs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/openssl/src/crypto.rs b/openssl/src/crypto.rs index 26f66d0e..3a031368 100644 --- a/openssl/src/crypto.rs +++ b/openssl/src/crypto.rs @@ -1,4 +1,4 @@ -use libc::{c_char, c_void}; +use libc::{c_char, c_int, c_void}; use std::fmt; use std::ffi::CStr; use std::slice; @@ -10,7 +10,9 @@ pub struct CryptoString(&'static str); impl<'s> Drop for CryptoString { fn drop(&mut self) { unsafe { - CRYPTO_free!(self.0.as_ptr() as *mut c_void); + CRYPTO_free(self.0.as_ptr() as *mut c_void, + concat!(file!(), "\0").as_ptr() as *const c_char, + line!() as c_int); } } } @@ -46,3 +48,12 @@ impl fmt::Debug for CryptoString { fmt::Debug::fmt(self.0, f) } } + +#[cfg(not(ossl110))] +#[allow(non_snake_case)] +unsafe fn CRYPTO_free(buf: *mut c_void, _: *const c_char, _: c_int) { + ::ffi::CRYPTO_free(buf); +} + +#[cfg(ossl110)] +use ffi::CRYPTO_free; |