sys (and bn): make CRYPTO_free() take a *mut c_void insead of a *const c_char
CRYPTO_free() ends up being used for a variety of types of data, not just c_char. And it essentially takes full ownership of the type, making *mut appropriate. With this change it also more closely (exactly) matches the C defintion: void CRYPTO_free(void *ptr);
This commit is contained in:
parent
b7c88101f5
commit
381a9b6e51
|
|
@ -295,7 +295,7 @@ extern "C" {
|
||||||
n: c_int,
|
n: c_int,
|
||||||
file: *const c_char,
|
file: *const c_char,
|
||||||
line: c_int));
|
line: c_int));
|
||||||
pub fn CRYPTO_free(buf: *const c_char);
|
pub fn CRYPTO_free(buf: *mut c_void);
|
||||||
pub fn CRYPTO_memcmp(a: *const c_void, b: *const c_void,
|
pub fn CRYPTO_memcmp(a: *const c_void, b: *const c_void,
|
||||||
len: size_t) -> c_int;
|
len: size_t) -> c_int;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use libc::{c_int, c_ulong};
|
use libc::{c_int, c_ulong, c_void};
|
||||||
use std::{fmt, ptr};
|
use std::{fmt, ptr};
|
||||||
use std::c_str::CString;
|
use std::c_str::CString;
|
||||||
|
|
||||||
|
|
@ -348,7 +348,7 @@ impl BigNum {
|
||||||
assert!(!buf.is_null());
|
assert!(!buf.is_null());
|
||||||
let c_str = CString::new(buf, false);
|
let c_str = CString::new(buf, false);
|
||||||
let str = c_str.as_str().unwrap().to_string();
|
let str = c_str.as_str().unwrap().to_string();
|
||||||
ffi::CRYPTO_free(buf);
|
ffi::CRYPTO_free(buf as *mut c_void);
|
||||||
str
|
str
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue