1
0
Fork 0

refactor: more strict standard

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@1112 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
This commit is contained in:
Xuefer 2012-08-01 17:55:06 +00:00
parent 278239409f
commit 328d09a12f
6 changed files with 28 additions and 13 deletions

View File

@ -9,6 +9,8 @@ if [[ $# -gt 0 ]]; then
shift
if [[ $# -gt 0 ]]; then
args=("$@")
elif [[ $type = "make" ]]; then
args=()
fi
fi
@ -141,7 +143,7 @@ phpize)
export PATH=$PHPDIRS/$phpbasename/bin:$PATH
phpize --clean \
&& phpize \
&& CFLAGS="-g -O0 -Wall -Wno-unused -W -Wshadow -Werror=implicit-function-declaration -std=c89 -D_GNU_SOURCE -D_POSIX_SOURCE -Dinline=" ./configure \
&& CFLAGS="-g -O0 -pedantic-errors -Wno-variadic-macros -Wno-long-long -Wall -Wno-unused -W -Wshadow -Werror=implicit-function-declaration -std=c89 -D_GNU_SOURCE -D_POSIX_SOURCE -Dinline=" ./configure \
--enable-xcache-cacher \
--enable-xcache-optimizer \
--enable-xcache-encoder \

View File

@ -0,0 +1 @@
static char dummy = 1;

View File

@ -0,0 +1 @@
static char dummy = 1;

View File

@ -140,7 +140,7 @@ static int op_array_convert_switch(zend_op_array *op_array) /* {{{ */
/* }}} */
/* {{{ op_flowinfo helper func */
enum {
XC_OPNUM_INVALID = -1,
XC_OPNUM_INVALID = -1
};
typedef struct {
int jmpout_op1;

View File

@ -46,7 +46,13 @@ DECL_STRUCT_P_FUNC(`$1', `$2', 1)
')
int xc_autocheck_assert_size = SIZEOF_$1, assert_count = COUNTOF_$1;
int xc_autocheck_done_size = 0, xc_autocheck_done_count = 0;
const char *xc_autocheck_assert_names[] = { ifdef(`ELEMENTSOF_$1', `ELEMENTSOF_$1') };
ifdef(`ELEMENTSOF_$1', `
const char *xc_autocheck_assert_names[] = { ELEMENTSOF_$1 };
size_t xc_autocheck_assert_names_count = sizeof(xc_autocheck_assert_names) / sizeof(xc_autocheck_assert_names[0]);
', `
const char **xc_autocheck_assert_names = NULL;
size_t xc_autocheck_assert_names_count = 0;
')
zend_bool xc_autocheck_skip = 0;
HashTable xc_autocheck_done_names;
zend_hash_init(&xc_autocheck_done_names, 0, NULL, NULL, 0);
@ -74,7 +80,7 @@ DECL_STRUCT_P_FUNC(`$1', `$2', 1)
IFAUTOCHECK(`
/* {{{ autocheck */
if (!xc_autocheck_skip) {
int name_check_errors = xc_check_names(__FILE__, __LINE__, "FUNC_NAME", xc_autocheck_assert_names, sizeof(xc_autocheck_assert_names) / sizeof(xc_autocheck_assert_names[0]), &xc_autocheck_done_names);
int name_check_errors = xc_check_names(__FILE__, __LINE__, "FUNC_NAME", xc_autocheck_assert_names, xc_autocheck_assert_names_count, &xc_autocheck_done_names);
if (xc_autocheck_done_count != assert_count) {
fprintf(stderr

View File

@ -50,12 +50,15 @@ void xc_compile_result_free(xc_compile_result_t *cr) /* {{{ */
}
/* }}} */
static int xc_apply_function(zend_function *zf, apply_func_t applyer TSRMLS_DC) /* {{{ */
typedef struct {
apply_func_t applyer;
} xc_apply_func_info;
static int xc_apply_function(zend_function *zf, xc_apply_func_info *fi TSRMLS_DC) /* {{{ */
{
switch (zf->type) {
case ZEND_USER_FUNCTION:
case ZEND_EVAL_CODE:
return applyer(&zf->op_array TSRMLS_CC);
return fi->applyer(&zf->op_array TSRMLS_CC);
break;
case ZEND_INTERNAL_FUNCTION:
@ -68,7 +71,7 @@ static int xc_apply_function(zend_function *zf, apply_func_t applyer TSRMLS_DC)
}
/* }}} */
typedef struct {
apply_func_t applyer;
xc_apply_func_info fi;
zend_class_entry *ce;
} xc_apply_method_info;
int xc_apply_method(zend_function *zf, xc_apply_method_info *mi TSRMLS_DC) /* {{{ */
@ -93,23 +96,25 @@ int xc_apply_method(zend_function *zf, xc_apply_method_info *mi TSRMLS_DC) /* {{
}
}
#endif
return xc_apply_function(zf, mi->applyer TSRMLS_CC);
return xc_apply_function(zf, &mi->fi TSRMLS_CC);
}
/* }}} */
static int xc_apply_cest(xc_cest_t *cest, apply_func_t applyer TSRMLS_DC) /* {{{ */
static int xc_apply_cest(xc_cest_t *cest, xc_apply_func_info *fi TSRMLS_DC) /* {{{ */
{
xc_apply_method_info mi;
mi.applyer = applyer;
mi.ce = CestToCePtr(*cest);
mi.fi = *fi;
mi.ce = CestToCePtr(*cest);
zend_hash_apply_with_argument(&(CestToCePtr(*cest)->function_table), (apply_func_arg_t) xc_apply_method, &mi TSRMLS_CC);
return 0;
}
/* }}} */
int xc_apply_op_array(xc_compile_result_t *cr, apply_func_t applyer TSRMLS_DC) /* {{{ */
{
zend_hash_apply_with_argument(cr->function_table, (apply_func_arg_t) xc_apply_function, (void *) applyer TSRMLS_CC);
zend_hash_apply_with_argument(cr->class_table, (apply_func_arg_t) xc_apply_cest, (void *) applyer TSRMLS_CC);
xc_apply_func_info fi;
fi.applyer = applyer;
zend_hash_apply_with_argument(cr->function_table, (apply_func_arg_t) xc_apply_function, &fi TSRMLS_CC);
zend_hash_apply_with_argument(cr->class_table, (apply_func_arg_t) xc_apply_cest, &fi TSRMLS_CC);
return applyer(cr->op_array TSRMLS_CC);
}