|
1 | 1 | use crate::allocation::{allocation_profiling_stats_should_collect, collect_allocation}; |
2 | 2 | use crate::bindings as zend; |
3 | | -use crate::{RefCellExt, PROFILER_NAME}; |
| 3 | +use crate::PROFILER_NAME; |
4 | 4 | use core::{cell::Cell, ptr}; |
5 | 5 | use lazy_static::lazy_static; |
6 | 6 | use libc::{c_char, c_int, c_void, size_t}; |
@@ -362,8 +362,7 @@ unsafe fn alloc_prof_prev_alloc(len: size_t) -> *mut c_void { |
362 | 362 |
|
363 | 363 | unsafe fn alloc_prof_orig_alloc(len: size_t) -> *mut c_void { |
364 | 364 | let heap = zend::zend_mm_get_heap(); |
365 | | - let ptr: *mut c_void = zend::_zend_mm_alloc(heap, len); |
366 | | - ptr |
| 365 | + zend::_zend_mm_alloc(heap, len) |
367 | 366 | } |
368 | 367 |
|
369 | 368 | /// This function exists because when calling `zend_mm_set_custom_handlers()`, |
@@ -418,20 +417,18 @@ unsafe fn alloc_prof_prev_realloc(prev_ptr: *mut c_void, len: size_t) -> *mut c_ |
418 | 417 |
|
419 | 418 | unsafe fn alloc_prof_orig_realloc(prev_ptr: *mut c_void, len: size_t) -> *mut c_void { |
420 | 419 | let heap = zend::zend_mm_get_heap(); |
421 | | - let ptr: *mut c_void = zend::_zend_mm_realloc(heap, prev_ptr, len); |
422 | | - ptr |
| 420 | + zend::_zend_mm_realloc(heap, prev_ptr, len) |
423 | 421 | } |
424 | 422 |
|
425 | 423 | unsafe extern "C" fn alloc_prof_gc() -> size_t { |
426 | 424 | tls_zend_mm_state_get!(gc)() |
427 | 425 | } |
428 | 426 |
|
429 | 427 | unsafe fn alloc_prof_prev_gc() -> size_t { |
430 | | - let gc = tls_zend_mm_state_get!(prev_custom_mm_gc); |
431 | | - if let Some(gc) = gc { |
432 | | - return gc(); |
| 428 | + match tls_zend_mm_state_get!(prev_custom_mm_gc) { |
| 429 | + Some(gc) => gc(), |
| 430 | + None => 0, |
433 | 431 | } |
434 | | - 0 |
435 | 432 | } |
436 | 433 |
|
437 | 434 | unsafe fn alloc_prof_orig_gc() -> size_t { |
|
0 commit comments