File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 8
8
# NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
9
9
# See the Mulan PSL v2 for more details.
10
10
11
- fn_args_layout = " Compressed"
11
+ fn_params_layout = " Compressed"
12
12
format_code_in_doc_comments = true
13
13
format_macro_bodies = true
14
14
format_macro_matchers = true
Original file line number Diff line number Diff line change 10
10
11
11
//! Apis relate to [crate::sys::zend_ini_entry_def].
12
12
13
- use crate :: sys:: * ;
13
+ use crate :: { c_str , sys:: * } ;
14
14
use std:: {
15
15
ffi:: { c_int, CStr } ,
16
16
mem:: zeroed,
@@ -99,10 +99,14 @@ pub trait FromIniValue {
99
99
impl FromIniValue for bool {
100
100
#[ allow( clippy:: useless_conversion) ]
101
101
fn from_ini_value ( name : & str ) -> Self {
102
- unsafe {
103
- let name_ptr = name. as_ptr ( ) as * mut u8 as * mut c_char ;
104
- zend_ini_long ( name_ptr, name. len ( ) . try_into ( ) . unwrap ( ) , 0 ) != 0
105
- }
102
+ let s = <Option < & CStr > >:: from_ini_value ( name) ;
103
+ [
104
+ Some ( c_str ! ( "1" ) ) ,
105
+ Some ( c_str ! ( "true" ) ) ,
106
+ Some ( c_str ! ( "on" ) ) ,
107
+ Some ( c_str ! ( "On" ) ) ,
108
+ ]
109
+ . contains ( & s)
106
110
}
107
111
}
108
112
You can’t perform that action at this time.
0 commit comments