mirror of
https://github.com/harfbuzz/harfbuzz.git
synced 2025-04-09 23:09:21 +00:00
[fontations] Adjust alignment requirement
This commit is contained in:
parent
8d300049f5
commit
fbb81e344b
1 changed files with 4 additions and 4 deletions
|
@ -28,22 +28,22 @@ struct MyAllocator;
|
|||
|
||||
unsafe impl GlobalAlloc for MyAllocator {
|
||||
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
|
||||
assert!(layout.align() <= 16);
|
||||
assert!(layout.align() <= 2 * std::mem::size_of::<*mut u8>());
|
||||
hb_malloc(layout.size()) as *mut u8
|
||||
}
|
||||
|
||||
unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 {
|
||||
assert!(layout.align() <= 16);
|
||||
assert!(layout.align() <= 2 * std::mem::size_of::<*mut u8>());
|
||||
hb_calloc(layout.size(), 1) as *mut u8
|
||||
}
|
||||
|
||||
unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 {
|
||||
assert!(layout.align() <= 16);
|
||||
assert!(layout.align() <= 2 * std::mem::size_of::<*mut u8>());
|
||||
hb_realloc(ptr as *mut c_void, new_size) as *mut u8
|
||||
}
|
||||
|
||||
unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
|
||||
assert!(layout.align() <= 16);
|
||||
assert!(layout.align() <= 2 * std::mem::size_of::<*mut u8>());
|
||||
hb_free(ptr as *mut c_void);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue