Skip to content

Commit

Permalink
These unwrap()'s can go unchecked 🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
realFlowControl committed Nov 25, 2024
1 parent b94da1a commit 1ef435b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions profiling/src/allocation/allocation_ge84.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ unsafe fn alloc_prof_prev_alloc(len: size_t) -> *mut c_void {
// Safety: `ZEND_MM_STATE.prev_custom_mm_alloc` will be initialised in
// `alloc_prof_rinit()` and only point to this function when
// `prev_custom_mm_alloc` is also initialised
let ptr = ((*zend_mm_state).prev_custom_mm_alloc.unwrap())(len);
let ptr = ((*zend_mm_state).prev_custom_mm_alloc.unwrap_unchecked())(len);
// Safety: `ZEND_MM_STATE.heap` got initialised in `alloc_prof_rinit()`
zend::zend_mm_set_heap((*zend_mm_state).heap);
ptr
Expand Down Expand Up @@ -278,7 +278,7 @@ unsafe fn alloc_prof_prev_free(ptr: *mut c_void) {
// Safety: `ZEND_MM_STATE.prev_custom_mm_free` will be initialised in
// `alloc_prof_rinit()` and only point to this function when
// `prev_custom_mm_free` is also initialised
((*zend_mm_state).prev_custom_mm_free.unwrap())(ptr);
((*zend_mm_state).prev_custom_mm_free.unwrap_unchecked())(ptr);
// Safety: `ZEND_MM_STATE.heap` got initialised in `alloc_prof_rinit()`
zend::zend_mm_set_heap((*zend_mm_state).heap);
})
Expand Down Expand Up @@ -316,7 +316,7 @@ unsafe fn alloc_prof_prev_realloc(prev_ptr: *mut c_void, len: size_t) -> *mut c_
// Safety: `ZEND_MM_STATE.prev_custom_mm_realloc` will be initialised in
// `alloc_prof_rinit()` and only point to this function when
// `prev_custom_mm_realloc` is also initialised
let ptr = ((*zend_mm_state).prev_custom_mm_realloc.unwrap())(prev_ptr, len);
let ptr = ((*zend_mm_state).prev_custom_mm_realloc.unwrap_unchecked())(prev_ptr, len);
// Safety: `ZEND_MM_STATE.heap` got initialised in `alloc_prof_rinit()`
zend::zend_mm_set_heap((*zend_mm_state).heap);
ptr
Expand All @@ -339,7 +339,7 @@ unsafe fn alloc_prof_prev_gc() -> size_t {
// Safety: `ZEND_MM_STATE.prev_custom_mm_gc` will be initialised in
// `alloc_prof_rinit()` and only point to this function when
// `prev_custom_mm_gc` is also initialised
let freed = ((*zend_mm_state).prev_custom_mm_gc.unwrap())();
let freed = ((*zend_mm_state).prev_custom_mm_gc.unwrap_unchecked())();
// Safety: `ZEND_MM_STATE.heap` got initialised in `alloc_prof_rinit()`
zend::zend_mm_set_heap((*zend_mm_state).heap);
freed
Expand All @@ -362,7 +362,7 @@ unsafe fn alloc_prof_prev_shutdown(full: bool, silent: bool) {
// Safety: `ZEND_MM_STATE.prev_custom_mm_shutdown` will be initialised in
// `alloc_prof_rinit()` and only point to this function when
// `prev_custom_mm_shutdown` is also initialised
((*zend_mm_state).prev_custom_mm_shutdown.unwrap())(full, silent);
((*zend_mm_state).prev_custom_mm_shutdown.unwrap_unchecked())(full, silent);
// Safety: `ZEND_MM_STATE.heap` got initialised in `alloc_prof_rinit()`
zend::zend_mm_set_heap((*zend_mm_state).heap);
})
Expand Down

0 comments on commit 1ef435b

Please sign in to comment.