Skip to content

Commit 9ebd055

Browse files
committed
Remove unused files.
1 parent bf98f75 commit 9ebd055

File tree

8 files changed

+24
-609
lines changed

8 files changed

+24
-609
lines changed

examples/simple/Makefile.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ TARGET_BUILD_DIR = "${TARGET_DIR}/release"
1212
dependencies = ["build"]
1313
script = [
1414
"""
15-
cp ${TARGET_BUILD_DIR}/lib${CARGO_MAKE_CRATE_NAME}.so `${PHP_CONFIG} --extension-dir` && \
15+
cp ${TARGET_BUILD_DIR}/lib${CARGO_MAKE_CRATE_NAME}.so `${PHP_CONFIG} --extension-dir`/${CARGO_MAKE_CRATE_NAME}.so && \
1616
echo Installing shared extensions: `${PHP_CONFIG} --extension-dir`
1717
"""
1818
]

examples/simple/src/lib.rs

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
use phper::c_str_ptr;
22
use phper::php_fn;
3-
use phper::sys::zend_function_entry;
4-
use phper::sys::zend_internal_arg_info;
5-
use phper::sys::zend_parse_parameters;
6-
use phper::sys::ZEND_RESULT_CODE_SUCCESS;
7-
use phper::sys::{zend_ini_entry_def, zend_module_entry};
3+
use phper::sys::{ZEND_RESULT_CODE_SUCCESS, zend_parse_parameters, zend_internal_arg_info, zend_function_entry, PHP_INI_SYSTEM};
4+
use phper::sys::{zend_ini_entry_def, zend_module_entry, zend_register_ini_entries, zend_unregister_ini_entries};
85
use phper::zend::api::FunctionEntries;
96
use phper::zend::compile::InternalArgInfos;
107
use phper::zend::ini::IniEntryDefs;
@@ -21,31 +18,37 @@ use std::mem::{size_of, transmute};
2118
use std::os::raw::{c_char, c_int, c_uchar, c_uint, c_ushort};
2219
use std::ptr::{null, null_mut};
2320

24-
static INI_ENTRIES: IniEntryDefs<1> = IniEntryDefs::new([
25-
// zend_ini_entry_def {
26-
// name: null(),
27-
// on_modify: None,
28-
// mh_arg1: null_mut(),
29-
// mh_arg2: null_mut(),
30-
// mh_arg3: null(),
31-
// value: null(),
32-
// displayer: None,
33-
// modifiable: 0,
34-
// name_length: 0,
35-
// value_length: 0,
36-
// },
21+
static INI_ENTRIES: IniEntryDefs<2> = IniEntryDefs::new([
22+
zend_ini_entry_def {
23+
name: c_str_ptr!("simple.enable"),
24+
on_modify: None,
25+
mh_arg1: null_mut(),
26+
mh_arg2: null_mut(),
27+
mh_arg3: null_mut(),
28+
value: c_str_ptr!("1"),
29+
displayer: None,
30+
modifiable: PHP_INI_SYSTEM as c_int,
31+
name_length: 0,
32+
value_length: 0,
33+
},
3734
unsafe { transmute([0u8; size_of::<zend_ini_entry_def>()]) },
3835
]);
3936

4037
#[php_minit_function]
4138
fn m_init_simple(type_: c_int, module_number: c_int) -> bool {
4239
println!("module init");
40+
unsafe {
41+
zend_register_ini_entries(INI_ENTRIES.get(), module_number);
42+
}
4343
true
4444
}
4545

4646
#[php_mshutdown_function]
4747
fn m_shutdown_simple(type_: c_int, module_number: c_int) -> bool {
4848
println!("module shutdown");
49+
unsafe {
50+
zend_unregister_ini_entries(module_number);
51+
}
4952
true
5053
}
5154

phper/src/arg.rs

Lines changed: 0 additions & 1 deletion
This file was deleted.

phper/src/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pub type PHPerResult<T> = Result<T, PHPerError>;
1+
pub type Result<T> = std::result::Result<T, self::Error>;
22

33
#[derive(thiserror::Error, Debug)]
4-
pub enum PHPerError {}
4+
pub enum Error {}

phper/src/function.rs

Lines changed: 0 additions & 210 deletions
This file was deleted.

0 commit comments

Comments
 (0)