@@ -7,72 +7,3 @@ pub type EBox<T> = Box<T>;
7
7
/// The Vec which use php `emalloc` and `efree` to manage memory.
8
8
/// TODO now feature `allocator_api` is still unstable, using global allocator instead.
9
9
pub type EVec < T > = Vec < T > ;
10
-
11
- // pub struct Allocator {
12
- // #[cfg(phper_debug)]
13
- // zend_filename: *const std::os::raw::c_char,
14
- // #[cfg(phper_debug)]
15
- // zend_lineno: u32,
16
- // #[cfg(phper_debug)]
17
- // zend_orig_filename: *const std::os::raw::c_char,
18
- // #[cfg(phper_debug)]
19
- // zend_orig_lineno: u32,
20
- // }
21
- //
22
- // impl Allocator {
23
- // pub const fn new(
24
- // #[cfg(phper_debug)] zend_filename: *const std::os::raw::c_char,
25
- // #[cfg(phper_debug)] zend_lineno: u32,
26
- // #[cfg(phper_debug)] zend_orig_filename: *const std::os::raw::c_char,
27
- // #[cfg(phper_debug)] zend_orig_lineno: u32,
28
- // ) -> Self {
29
- // Self {
30
- // #[cfg(phper_debug)]
31
- // zend_filename,
32
- // #[cfg(phper_debug)]
33
- // zend_lineno,
34
- // #[cfg(phper_debug)]
35
- // zend_orig_filename,
36
- // #[cfg(phper_debug)]
37
- // zend_orig_lineno,
38
- // }
39
- // }
40
- // }
41
- //
42
- // unsafe impl AllocRef for Allocator {
43
- // fn alloc(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> {
44
- // unsafe {
45
- // #[cfg(phper_debug)]
46
- // let ptr = _emalloc(
47
- // layout.size(),
48
- // self.zend_filename,
49
- // self.zend_lineno,
50
- // self.zend_orig_filename,
51
- // self.zend_orig_lineno,
52
- // );
53
- // #[cfg(not(phper_debug))]
54
- // let ptr = _emalloc(layout.size());
55
- //
56
- // if ptr.is_null() {
57
- // Err(AllocError)
58
- // } else {
59
- // let ptr = slice_from_raw_parts_mut(ptr.cast(), layout.size());
60
- // Ok(NonNull::new_unchecked(ptr))
61
- // }
62
- // }
63
- // }
64
- //
65
- // unsafe fn dealloc(&self, ptr: NonNull<u8>, _layout: Layout) {
66
- // // Not the correct position of `efree`, but can work!.
67
- // #[cfg(phper_debug)]
68
- // _efree(
69
- // ptr.as_ptr().cast(),
70
- // self.zend_filename,
71
- // self.zend_lineno,
72
- // self.zend_orig_filename,
73
- // self.zend_orig_lineno,
74
- // );
75
- // #[cfg(not(phper_debug))]
76
- // _efree(ptr.as_ptr().cast());
77
- // }
78
- // }
0 commit comments