Skip to content

Commit 12d2231

Browse files
committed
Added alloc_host and changed to use to_str -> to_owned
1 parent 103681e commit 12d2231

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/device/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
extern crate libc;
22

3-
use defines::AfError;
3+
use defines::{AfError, DType};
44
use error::HANDLE_ERROR;
55
use self::libc::{c_int, size_t, c_char, c_void};
66
use std::ffi::CString;
@@ -22,7 +22,8 @@ extern {
2222
fn af_device_gc() -> c_int;
2323
fn af_sync(device: c_int) -> c_int;
2424

25-
fn af_free_host (ptr: *mut c_void) -> c_int;
25+
fn af_alloc_host(elements: size_t, _type: DType) -> *mut c_void;
26+
fn af_free_host(ptr: *mut c_void) -> c_int;
2627
}
2728

2829
/// Get ArrayFire Version Number
@@ -76,7 +77,7 @@ pub fn info_string(verbose: bool) -> String {
7677
let err_val = af_info_string(&mut tmp, verbose);
7778
HANDLE_ERROR(AfError::from(err_val));
7879

79-
let result = CString::from_raw(tmp).into_string().unwrap();
80+
let result = (*CString::from_raw(tmp)).to_str().unwrap().to_owned();
8081

8182
let err_val = af_free_host(tmp as *mut c_void);
8283
HANDLE_ERROR(AfError::from(err_val));

0 commit comments

Comments
 (0)