Skip to content

Commit 5b88923

Browse files
committed
Rename ini entry.
1 parent bc4a8d2 commit 5b88923

File tree

3 files changed

+6
-14
lines changed

3 files changed

+6
-14
lines changed

examples/hello/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ use phper::{
1414
},
1515
};
1616

17-
static SIMPLE_ENABLE: ModuleGlobals<bool> = ModuleGlobals::new(false);
17+
static HELLO_ENABLE: ModuleGlobals<bool> = ModuleGlobals::new(false);
1818

19-
static INI_ENTRIES: IniEntries<1> = IniEntries::new([SIMPLE_ENABLE.create_ini_entry(
19+
static INI_ENTRIES: IniEntries<1> = IniEntries::new([HELLO_ENABLE.create_ini_entry(
2020
"hello.enable",
2121
"1",
2222
Some(OnUpdateBool),
@@ -53,7 +53,7 @@ fn module_info(module: &ModuleEntry) {
5353
php_info_print_table_row(
5454
2,
5555
c_str_ptr!("hello.enable"),
56-
if SIMPLE_ENABLE.get() {
56+
if HELLO_ENABLE.get() {
5757
c_str_ptr!("1")
5858
} else {
5959
c_str_ptr!("0")
@@ -71,7 +71,7 @@ pub fn say_hello(execute_data: &mut ExecuteData) -> impl SetVal {
7171
}
7272

7373
static ARG_INFO_SAY_HELLO: MultiInternalArgInfo<1> =
74-
MultiInternalArgInfo::new(1, false, [create_zend_arg_info(c_str_ptr!("name"), false)]);
74+
MultiInternalArgInfo::new(1, false, [create_zend_arg_info(c_str_ptr!("n_ame"), false)]);
7575

7676
static FUNCTION_ENTRIES: FunctionEntries<1> = FunctionEntries::new([zend_function_entry {
7777
fname: c_str_ptr!("say_hello"),

phper-macros/src/inner.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
use proc_macro::TokenStream;
22
use quote::quote;
3-
use syn::{parse_macro_input, Ident, ItemFn, Visibility};
4-
5-
pub(crate) fn rename(input: TokenStream, prefix: impl ToString) -> TokenStream {
6-
let input = parse_macro_input!(input as Ident);
7-
let name = prefix.to_string() + &input.to_string();
8-
let name = Ident::new(&name, input.span().clone());
9-
let result = quote! { #name };
10-
result.into()
11-
}
3+
use syn::{parse_macro_input, ItemFn, Visibility};
124

135
pub(crate) fn hook_fn(input: TokenStream) -> TokenStream {
146
let input = parse_macro_input!(input as ItemFn);

phper-macros/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ mod alloc;
22
mod inner;
33
mod utils;
44

5-
use crate::inner::{hook_fn, info_fn, rename};
5+
use crate::inner::{hook_fn, info_fn};
66
use proc_macro::TokenStream;
77

88
#[proc_macro]

0 commit comments

Comments
 (0)