Skip to content

Commit 0f86a71

Browse files
committed
Remove unused codes.
1 parent ba5464b commit 0f86a71

File tree

2 files changed

+1
-69
lines changed

2 files changed

+1
-69
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ A library that allows us to write PHP extensions using pure Rust and using safe
66

77
## Requirement
88

9+
- php version:
910
- libclang >= 9
1011

1112
## Usage

phper-alloc/src/lib.rs

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -7,72 +7,3 @@ pub type EBox<T> = Box<T>;
77
/// The Vec which use php `emalloc` and `efree` to manage memory.
88
/// TODO now feature `allocator_api` is still unstable, using global allocator instead.
99
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

Comments
 (0)