@@ -49,39 +49,43 @@ unsafe extern "C" fn module_startup(_type: c_int, module_number: c_int) -> c_int
4949 class_entity. declare_properties ( ce) ;
5050 }
5151
52- match take ( & mut module. module_init ) {
53- Some ( f) => f ( ) as c_int ,
54- None => 1 ,
52+ if let Some ( f) = take ( & mut module. module_init ) {
53+ f ( ) ;
5554 }
55+
56+ ZEND_RESULT_CODE_SUCCESS
5657}
5758
5859unsafe extern "C" fn module_shutdown ( _type : c_int , module_number : c_int ) -> c_int {
5960 let module = GLOBAL_MODULE . as_mut ( ) . unwrap ( ) ;
6061
6162 ini:: unregister ( module_number) ;
6263
63- match take ( & mut module. module_shutdown ) {
64- Some ( f) => f ( ) as c_int ,
65- None => 1 ,
64+ if let Some ( f) = take ( & mut module. module_shutdown ) {
65+ f ( ) ;
6666 }
67+
68+ ZEND_RESULT_CODE_SUCCESS
6769}
6870
6971unsafe extern "C" fn request_startup ( _type : c_int , _module_number : c_int ) -> c_int {
7072 let module = GLOBAL_MODULE . as_ref ( ) . unwrap ( ) ;
7173
72- match & module. request_init {
73- Some ( f) => f ( ) as c_int ,
74- None => 1 ,
74+ if let Some ( f) = & module. request_init {
75+ f ( ) ;
7576 }
77+
78+ ZEND_RESULT_CODE_SUCCESS
7679}
7780
7881unsafe extern "C" fn request_shutdown ( _type : c_int , _module_number : c_int ) -> c_int {
7982 let module = GLOBAL_MODULE . as_ref ( ) . unwrap ( ) ;
8083
81- match & module. request_shutdown {
82- Some ( f) => f ( ) as c_int ,
83- None => 1 ,
84+ if let Some ( f) = & module. request_shutdown {
85+ f ( ) ;
8486 }
87+
88+ ZEND_RESULT_CODE_SUCCESS
8589}
8690
8791unsafe extern "C" fn module_info ( zend_module : * mut zend_module_entry ) {
@@ -108,10 +112,10 @@ pub struct Module {
108112 name : CString ,
109113 version : CString ,
110114 author : CString ,
111- module_init : Option < Box < dyn FnOnce ( ) -> bool + Send + Sync > > ,
112- module_shutdown : Option < Box < dyn FnOnce ( ) -> bool + Send + Sync > > ,
113- request_init : Option < Box < dyn Fn ( ) -> bool + Send + Sync > > ,
114- request_shutdown : Option < Box < dyn Fn ( ) -> bool + Send + Sync > > ,
115+ module_init : Option < Box < dyn FnOnce ( ) > > ,
116+ module_shutdown : Option < Box < dyn FnOnce ( ) > > ,
117+ request_init : Option < Box < dyn Fn ( ) > > ,
118+ request_shutdown : Option < Box < dyn Fn ( ) > > ,
115119 function_entities : Vec < FunctionEntity > ,
116120 class_entities : Vec < ClassEntity < ( ) > > ,
117121 constants : Vec < Constant > ,
@@ -141,22 +145,22 @@ impl Module {
141145 }
142146
143147 /// Register `MINIT` hook.
144- pub fn on_module_init ( & mut self , func : impl FnOnce ( ) -> bool + Send + Sync + ' static ) {
148+ pub fn on_module_init ( & mut self , func : impl FnOnce ( ) + ' static ) {
145149 self . module_init = Some ( Box :: new ( func) ) ;
146150 }
147151
148152 /// Register `MSHUTDOWN` hook.
149- pub fn on_module_shutdown ( & mut self , func : impl FnOnce ( ) -> bool + Send + Sync + ' static ) {
153+ pub fn on_module_shutdown ( & mut self , func : impl FnOnce ( ) + ' static ) {
150154 self . module_shutdown = Some ( Box :: new ( func) ) ;
151155 }
152156
153157 /// Register `RINIT` hook.
154- pub fn on_request_init ( & mut self , func : impl Fn ( ) -> bool + Send + Sync + ' static ) {
158+ pub fn on_request_init ( & mut self , func : impl Fn ( ) + ' static ) {
155159 self . request_init = Some ( Box :: new ( func) ) ;
156160 }
157161
158162 /// Register `RSHUTDOWN` hook.
159- pub fn on_request_shutdown ( & mut self , func : impl Fn ( ) -> bool + Send + Sync + ' static ) {
163+ pub fn on_request_shutdown ( & mut self , func : impl Fn ( ) + ' static ) {
160164 self . request_shutdown = Some ( Box :: new ( func) ) ;
161165 }
162166
0 commit comments