From 619a40cb85abe4d6684429b412405f43cb448897 Mon Sep 17 00:00:00 2001 From: Xuefer Date: Wed, 18 Jul 2012 08:00:28 +0000 Subject: [PATCH] refactor mshutdown minit git-svn-id: svn://svn.lighttpd.net/xcache/trunk@992 c26eb9a1-5813-0410-bd6c-c2e55f420ca7 --- submodules/xc_coverager.c | 6 +++--- submodules/xc_coverager.h | 4 ++-- xcache.c | 8 ++++---- xcache/xc_sandbox.c | 7 +++---- xcache/xc_sandbox.h | 3 +++ xcache/xc_utils.h | 3 --- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/submodules/xc_coverager.c b/submodules/xc_coverager.c index 3ff1c39..fbf570a 100644 --- a/submodules/xc_coverager.c +++ b/submodules/xc_coverager.c @@ -468,8 +468,8 @@ void xc_coverager_handle_ext_stmt(zend_op_array *op_array, zend_uchar op) /* {{{ } /* }}} */ -/* init/destroy */ -int xc_coverager_init(int module_number TSRMLS_DC) /* {{{ */ +/* MINIT/MSHUTDOWN */ +int xc_coverager_module_init(int module_number TSRMLS_DC) /* {{{ */ { old_compile_file = zend_compile_file; zend_compile_file = xc_compile_file_for_coverage; @@ -492,7 +492,7 @@ int xc_coverager_init(int module_number TSRMLS_DC) /* {{{ */ return SUCCESS; } /* }}} */ -void xc_coverager_destroy() /* {{{ */ +void xc_coverager_module_shutdown() /* {{{ */ { if (old_compile_file == xc_compile_file_for_coverage) { zend_compile_file = old_compile_file; diff --git a/submodules/xc_coverager.h b/submodules/xc_coverager.h index defd3ae..fceab75 100644 --- a/submodules/xc_coverager.h +++ b/submodules/xc_coverager.h @@ -2,8 +2,8 @@ #include "xcache.h" void xc_coverager_handle_ext_stmt(zend_op_array *op_array, zend_uchar op); -int xc_coverager_init(int module_number TSRMLS_DC); -void xc_coverager_destroy(); +int xc_coverager_module_init(int module_number TSRMLS_DC); +void xc_coverager_module_shutdown(); void xc_coverager_request_init(TSRMLS_D); void xc_coverager_request_shutdown(TSRMLS_D); PHP_FUNCTION(xcache_coverager_decode); diff --git a/xcache.c b/xcache.c index 5d72054..2314848 100644 --- a/xcache.c +++ b/xcache.c @@ -3939,9 +3939,9 @@ static PHP_MINIT_FUNCTION(xcache) #endif } - xc_util_init(module_number TSRMLS_CC); + xc_sandbox_module_init(module_number TSRMLS_CC); #ifdef HAVE_XCACHE_COVERAGER - xc_coverager_init(module_number TSRMLS_CC); + xc_coverager_module_init(module_number TSRMLS_CC); #endif return SUCCESS; @@ -3954,9 +3954,9 @@ err_init: static PHP_MSHUTDOWN_FUNCTION(xcache) { #ifdef HAVE_XCACHE_COVERAGER - xc_coverager_destroy(); + xc_coverager_module_shutdown(); #endif - xc_util_destroy(); + xc_sandbox_module_shutdown(); if (xc_initized) { xc_destroy(); diff --git a/xcache/xc_sandbox.c b/xcache/xc_sandbox.c index 34ee4b5..44864f9 100644 --- a/xcache/xc_sandbox.c +++ b/xcache/xc_sandbox.c @@ -433,8 +433,8 @@ zend_uint xc_sandbox_compilererror_cnt(TSRMLS_D) /* {{{ */ /* }}} */ #endif -/* init/destroy */ -int xc_util_init(int module_number TSRMLS_DC) /* {{{ */ +/* MINIT/MSHUTDOWN */ +int xc_sandbox_module_init(int module_number TSRMLS_DC) /* {{{ */ { #ifdef XCACHE_ERROR_CACHING old_zend_error_cb = zend_error_cb; @@ -444,7 +444,7 @@ int xc_util_init(int module_number TSRMLS_DC) /* {{{ */ return SUCCESS; } /* }}} */ -void xc_util_destroy() /* {{{ */ +void xc_sandbox_module_shutdown() /* {{{ */ { #ifdef XCACHE_ERROR_CACHING if (zend_error_cb == xc_sandbox_error_cb) { @@ -453,4 +453,3 @@ void xc_util_destroy() /* {{{ */ #endif } /* }}} */ - diff --git a/xcache/xc_sandbox.h b/xcache/xc_sandbox.h index d6a4908..b42df93 100644 --- a/xcache/xc_sandbox.h +++ b/xcache/xc_sandbox.h @@ -8,6 +8,9 @@ /* Purpose: run specified function in compiler sandbox, restore everything to previous state after it returns */ +int xc_sandbox_module_init(int module_number TSRMLS_DC); +void xc_sandbox_module_shutdown(); + /* return op_array to install */ typedef zend_op_array *(*xc_sandboxed_func_t)(void *data TSRMLS_DC); zend_op_array *xc_sandbox(xc_sandboxed_func_t sandboxed_func, void *data, ZEND_24(NOTHING, const) char *filename TSRMLS_DC); diff --git a/xcache/xc_utils.h b/xcache/xc_utils.h index e785817..f84de07 100644 --- a/xcache/xc_utils.h +++ b/xcache/xc_utils.h @@ -1,9 +1,6 @@ #include "php.h" #include "xcache.h" -int xc_util_init(int module_number TSRMLS_DC); -void xc_util_destroy(); - typedef struct { zend_op_array *op_array; HashTable *function_table;