Skip to content

Commit 92334f8

Browse files
committed
Merge pull request #92 from PistonDevelopers/revert-90-master
Revert "Moved `MEMORY` to local variable in `Library::init`"
2 parents 6eea6c2 + a30d629 commit 92334f8

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/library.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,24 @@ extern "C" fn realloc_library(_memory: ffi::FT_Memory,
3434
}
3535
}
3636

37+
static MEMORY: ffi::FT_MemoryRec = ffi::FT_MemoryRec {
38+
user: 0 as *mut c_void,
39+
alloc: alloc_library,
40+
free: free_library,
41+
realloc: realloc_library,
42+
};
43+
44+
3745
pub struct Library {
3846
raw: ffi::FT_Library,
3947
}
4048

4149
impl Library {
4250
pub fn init() -> FtResult<Library> {
43-
let memory = ffi::FT_MemoryRec {
44-
user: 0 as *mut c_void,
45-
alloc: alloc_library,
46-
free: free_library,
47-
realloc: realloc_library,
48-
};
4951
unsafe {
5052
let mut raw = std::ptr::null_mut();
5153

52-
let err = ffi::FT_New_Library(&memory, &mut raw);
54+
let err = ffi::FT_New_Library(&MEMORY, &mut raw);
5355
if err == ffi::FT_Err_Ok {
5456
ffi::FT_Add_Default_Modules(raw);
5557
Ok(Library {

0 commit comments

Comments
 (0)