aboutsummaryrefslogtreecommitdiff
path: root/openssl-sys/src
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2015-10-05 22:05:58 +0100
committerSteven Fackler <[email protected]>2015-10-05 22:05:58 +0100
commit0ca71a98fff158d35f5a80b10917bd93f48581b0 (patch)
tree5a1d75b62edc4781189d67f3f68a4bfe5b4b50a0 /openssl-sys/src
parentMerge pull request #282 from Manishearth/threadid (diff)
downloadrust-openssl-0ca71a98fff158d35f5a80b10917bd93f48581b0.tar.xz
rust-openssl-0ca71a98fff158d35f5a80b10917bd93f48581b0.zip
Clean up init stuff
Diffstat (limited to 'openssl-sys/src')
-rw-r--r--openssl-sys/src/lib.rs12
-rw-r--r--openssl-sys/src/openssl_shim.c5
2 files changed, 8 insertions, 9 deletions
diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs
index e5dfdc82..d40d299d 100644
--- a/openssl-sys/src/lib.rs
+++ b/openssl-sys/src/lib.rs
@@ -252,10 +252,10 @@ extern fn locking_function(mode: c_int, n: c_int, _file: *const c_char,
}
pub fn init() {
- static mut INIT: Once = ONCE_INIT;
+ static INIT: Once = ONCE_INIT;
- unsafe {
- INIT.call_once(|| {
+ INIT.call_once(|| {
+ unsafe {
SSL_library_init();
SSL_load_error_strings();
@@ -270,9 +270,9 @@ pub fn init() {
GUARDS = mem::transmute(guards);
CRYPTO_set_locking_callback(locking_function);
- unsafe{ rust_openssl_set_id_callback(); }
- })
- }
+ rust_openssl_set_id_callback();
+ }
+ })
}
pub unsafe fn SSL_CTX_set_options(ssl: *mut SSL_CTX, op: u64) -> u64 {
diff --git a/openssl-sys/src/openssl_shim.c b/openssl-sys/src/openssl_shim.c
index abfa3918..f0f55b27 100644
--- a/openssl-sys/src/openssl_shim.c
+++ b/openssl-sys/src/openssl_shim.c
@@ -10,12 +10,11 @@
unsigned long thread_id()
{
- unsigned long ret = (unsigned long)pthread_self();
- return ret;
+ return (unsigned long) pthread_self();
}
void rust_openssl_set_id_callback() {
- CRYPTO_set_id_callback((unsigned long (*)())thread_id);
+ CRYPTO_set_id_callback(thread_id);
}
#else