diff options
author | Chelsea Holland Komlo <me@chelseakomlo.com> | 2017-10-11 15:21:20 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-10-27 10:02:08 -0400 |
commit | be583a34a3815c2c10e86094ab0610e4b7f9c869 (patch) | |
tree | be9ffef37a21f54a81e628c1911c9171bbeef202 /src/rust/external | |
parent | 0c04b54d4d78f7f3117948358b3d05e644fa1aeb (diff) | |
download | tor-be583a34a3815c2c10e86094ab0610e4b7f9c869.tar.gz tor-be583a34a3815c2c10e86094ab0610e4b7f9c869.zip |
use tor allocator for string allocation in rust
Diffstat (limited to 'src/rust/external')
-rw-r--r-- | src/rust/external/external.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/rust/external/external.rs b/src/rust/external/external.rs index f3267949c7..09d80cb2ba 100644 --- a/src/rust/external/external.rs +++ b/src/rust/external/external.rs @@ -16,14 +16,15 @@ pub fn c_tor_version_as_new_as(platform: &str, cutoff: &str) -> bool { Ok(n) => n, Err(_) => return false, }; + let c_cutoff = match CString::new(cutoff) { Ok(n) => n, Err(_) => return false, }; - let result: c_int; - unsafe { - result = tor_version_as_new_as(c_platform.as_ptr(), c_cutoff.as_ptr()); - } + let result: c_int = unsafe { + tor_version_as_new_as(c_platform.as_ptr(), c_cutoff.as_ptr()) + }; + result == 1 } |