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 88# NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
99# See the Mulan PSL v2 for more details.
1010
11- fn_args_layout = " Compressed"
11+ fn_params_layout = " Compressed"
1212format_code_in_doc_comments = true
1313format_macro_bodies = true
1414format_macro_matchers = true
Original file line number Diff line number Diff line change 1010
1111//! Apis relate to [crate::sys::zend_ini_entry_def].
1212
13- use crate :: sys:: * ;
13+ use crate :: { c_str , sys:: * } ;
1414use std:: {
1515 ffi:: { c_int, CStr } ,
1616 mem:: zeroed,
@@ -99,10 +99,14 @@ pub trait FromIniValue {
9999impl FromIniValue for bool {
100100 #[ allow( clippy:: useless_conversion) ]
101101 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)
106110 }
107111}
108112
You can’t perform that action at this time.
0 commit comments