diff options
| author | Erick Tryzelaar <[email protected]> | 2012-07-03 20:28:46 -0700 |
|---|---|---|
| committer | Erick Tryzelaar <[email protected]> | 2012-07-03 20:28:46 -0700 |
| commit | 0099d25ae08f49feeb72707d84edcbaa2a295dc1 (patch) | |
| tree | e8d9931d3eea75668ec7664a735df5fc1203a6fd /rand.rs | |
| parent | Fix no-implicit-copies warnings (diff) | |
| download | rust-openssl-0099d25ae08f49feeb72707d84edcbaa2a295dc1.tar.xz rust-openssl-0099d25ae08f49feeb72707d84edcbaa2a295dc1.zip | |
Update to latest rustc syntax.
Diffstat (limited to 'rand.rs')
| -rw-r--r-- | rand.rs | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -2,16 +2,16 @@ import libc::{c_uchar, c_int}; #[link_name = "crypto"] #[abi = "cdecl"] -native mod _native { +extern mod libcrypto { fn RAND_bytes(buf: *c_uchar, num: c_int) -> c_int; } -fn rand_bytes(len: uint) -> [u8] { - let mut out = []; +fn rand_bytes(len: uint) -> ~[u8] { + let mut out = ~[]; vec::reserve(out, len); - vec::as_buf(out) { |out_buf| - let r = _native::RAND_bytes(out_buf, len as c_int); + do vec::as_buf(out) |out_buf| { + let r = libcrypto::RAND_bytes(out_buf, len as c_int); if r != 1 as c_int { fail } unsafe { vec::unsafe::set_len(out, len); } |