1
0
Fork 0

use XCACHE_ERROR_CACHING macro to simplify ifdefs

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@669 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
3.0
Xuefer 14 years ago
parent 80634fd463
commit 86ca8105aa

@ -529,7 +529,7 @@ ZESW(xc_cest_t *, void) xc_install_class(char *filename, xc_cest_t *cest, int op
#define TG(x) (sandbox->tmp_##x)
#define OG(x) (sandbox->orig_##x)
/* }}} */
#if defined(E_STRICT) || defined(E_DEPRECATED)
#ifdef XCACHE_ERROR_CACHING
static void xc_sandbox_error_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) /* {{{ */
{
xc_compilererror_t *compilererror;
@ -539,7 +539,7 @@ static void xc_sandbox_error_cb(int type, const char *error_filename, const uint
sandbox = (xc_sandbox_t *) XG(sandbox);
assert(sandbox != NULL);
switch (type) {
#ifdef E_STRICT:
#ifdef E_STRICT
case E_STRICT:
#endif
#ifdef E_DEPRECATED
@ -739,7 +739,7 @@ xc_sandbox_t *xc_sandbox_init(xc_sandbox_t *sandbox, char *filename TSRMLS_DC) /
sandbox->filename = filename;
#ifdef E_STRICT
#ifdef XCACHE_ERROR_CACHING
sandbox->orig_user_error_handler_error_reporting = EG(user_error_handler_error_reporting);
EG(user_error_handler_error_reporting) = 0;
@ -822,7 +822,7 @@ static void xc_sandbox_install(xc_sandbox_t *sandbox, xc_install_action_t instal
#endif
}
#ifdef E_STRICT
#ifdef XCACHE_ERROR_CACHING
/* restore trigger errors */
for (i = 0; i < sandbox->compilererror_cnt; i ++) {
xc_compilererror_t *error = &sandbox->compilererrors[i];
@ -839,7 +839,7 @@ static void xc_sandbox_install(xc_sandbox_t *sandbox, xc_install_action_t instal
void xc_sandbox_free(xc_sandbox_t *sandbox, xc_install_action_t install TSRMLS_DC) /* {{{ */
{
XG(sandbox) = NULL;
#ifdef E_STRICT
#ifdef XCACHE_ERROR_CACHING
EG(user_error_handler_error_reporting) = sandbox->orig_user_error_handler_error_reporting;
zend_error_cb = sandbox->orig_zend_error_cb;
#endif
@ -885,7 +885,7 @@ void xc_sandbox_free(xc_sandbox_t *sandbox, xc_install_action_t install TSRMLS_D
/* restore orig here, as EG/CG holded tmp before */
memcpy(&EG(included_files), &OG(included_files), sizeof(EG(included_files)));
#ifdef E_STRICT
#ifdef XCACHE_ERROR_CACHING
if (sandbox->compilererrors) {
zend_uint i;
for (i = 0; i < sandbox->compilererror_cnt; i ++) {

@ -73,6 +73,10 @@ void xc_install_constant(char *filename, zend_constant *constant, zend_uchar typ
void xc_install_function(char *filename, zend_function *func, zend_uchar type, zstr key, uint len, ulong h TSRMLS_DC);
ZESW(xc_cest_t *, void) xc_install_class(char *filename, xc_cest_t *cest, int oplineno, zend_uchar type, zstr key, uint len, ulong h TSRMLS_DC);
#if defined(E_STRICT) || defined(E_DEPRECATED)
#define XCACHE_ERROR_CACHING
#endif
/* sandbox */
typedef struct {
int alloc;
@ -97,7 +101,7 @@ typedef struct {
Bucket *tmp_internal_function_tail;
Bucket *tmp_internal_class_tail;
#if defined(E_STRICT) || defined(E_DEPRECATED)
#ifdef XCACHE_ERROR_CACHING
int orig_user_error_handler_error_reporting;
void (*orig_zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args);
zend_uint compilererror_cnt;

@ -755,7 +755,7 @@ static zend_op_array *xc_entry_install(xc_entry_t *xce, zend_file_handle *h TSRM
zend_u_is_auto_global(aginfo->type, aginfo->key, aginfo->key_len TSRMLS_CC);
}
#endif
#ifdef E_STRICT
#ifdef XCACHE_ERROR_CACHING
/* restore trigger errors */
for (i = 0; i < p->compilererror_cnt; i ++) {
xc_compilererror_t *error = &p->compilererrors[i];
@ -1535,7 +1535,7 @@ static zend_op_array *xc_compile_php(xc_entry_data_php_t *php, zend_file_handle
#endif
#undef X_FREE_UNUSED
/* }}} */
#ifdef E_STRICT
#ifdef XCACHE_ERROR_CACHING
php->compilererrors = ((xc_sandbox_t *) XG(sandbox))->compilererrors;
php->compilererror_cnt = ((xc_sandbox_t *) XG(sandbox))->compilererror_cnt;
#endif

Loading…
Cancel
Save