diff --git a/processor/head.m4 b/processor/head.m4 index ff19a09..2da504e 100644 --- a/processor/head.m4 +++ b/processor/head.m4 @@ -62,8 +62,13 @@ typedef char *xc_ztstring; typedef zend_trait_alias *zend_trait_alias_ptr; typedef zend_trait_precedence *zend_trait_precedence_ptr; #endif +#ifdef ZEND_ENGINE_2_3 +typedef int last_brk_cont_t; +#else +typedef zend_uint last_brk_cont_t; +#endif -typedef zend_uchar xc_zval_data_type; +typedef zend_uchar xc_zval_type_t; typedef int xc_op_type; typedef zend_uchar xc_opcode; #ifdef IS_UNICODE diff --git a/processor/process.m4 b/processor/process.m4 index 06cf01b..4396775 100644 --- a/processor/process.m4 +++ b/processor/process.m4 @@ -19,7 +19,7 @@ define(`PROCESS_xc_ztstring', `dnl {{{ (1:elm) popdef(`REALPTRTYPE') ') dnl }}} -define(`PROCESS_zval_data_type', `dnl {{{ (1:elm) +define(`PROCESS_xc_zval_type_t', `dnl {{{ (1:elm) IFDPRINT(` INDENT() fprintf(stderr, ":$1:\t%d %s\n", SRC(`$1'), xc_get_data_type(SRC(`$1'))); @@ -27,7 +27,7 @@ define(`PROCESS_zval_data_type', `dnl {{{ (1:elm) ', `PROCESS_SCALAR(`$1')') ') dnl }}} -define(`PROCESS_op_type', `dnl {{{ (1:elm) +define(`PROCESS_xc_op_type', `dnl {{{ (1:elm) IFDPRINT(` INDENT() fprintf(stderr, ":$1:\t%d %s\n", SRC(`$1'), xc_get_op_type(SRC(`$1'))); @@ -35,7 +35,7 @@ define(`PROCESS_op_type', `dnl {{{ (1:elm) ', `PROCESS_SCALAR(`$1')') ') dnl }}} -define(`PROCESS_opcode', `dnl {{{ (1:elm) +define(`PROCESS_xc_opcode', `dnl {{{ (1:elm) IFDPRINT(` INDENT() fprintf(stderr, ":$1:\t%u %s\n", SRC(`$1'), xc_get_opcode(SRC(`$1'))); @@ -65,11 +65,12 @@ define(`PROCESS', `dnl PROCESS(1:type, 2:elm) , `$1', `double', `PROCESS_SCALAR(`$2', `f', `$1')' , `$1', `xc_entry_type_t', `PROCESS_SCALAR(`$2', `d', `$1')' , `$1', `xc_hash_value_t', `PROCESS_SCALAR(`$2', `lu', `$1')' + , `$1', `last_brk_cont_t', `PROCESS_SCALAR(`$2', `d', `$1')' , `$1', `xc_ztstring', `PROCESS_xc_ztstring(`$2')' - , `$1', `xc_zval_data_type', `PROCESS_zval_data_type(`$2')' - , `$1', `xc_op_type', `PROCESS_op_type(`$2')' - , `$1', `xc_opcode', `PROCESS_opcode(`$2')' + , `$1', `xc_zval_type_t', `PROCESS_xc_zval_type_t(`$2')' + , `$1', `xc_op_type', `PROCESS_xc_op_type(`$2')' + , `$1', `xc_opcode', `PROCESS_xc_opcode(`$2')' , `$1', `opcode_handler_t', `/* is copying enough? */COPY(`$2')' , `$1', `xc_md5sum_t', `COPY(`$2')' , `', `', `m4_errprint(`AUTOCHECK ERROR: Unknown type "$1"')define(`EXIT_PENDING', 1)' diff --git a/processor/processor.m4 b/processor/processor.m4 index 9bbeb32..efc8b84 100644 --- a/processor/processor.m4 +++ b/processor/processor.m4 @@ -140,7 +140,7 @@ proc_unicode: ') dnl }}} DONE(value) - PROCESS(xc_zval_data_type, type) + PROCESS(xc_zval_type_t, type) #ifdef ZEND_ENGINE_2_3 PROCESS(zend_uchar, is_ref__gc) #else @@ -379,9 +379,9 @@ DEF_STRUCT_P_FUNC(`zend_class_entry', , `dnl {{{ #endif #ifdef ZEND_ENGINE_2_4 - STRUCT_ARRAY(default_properties_count, zval_ptr_nullable, default_properties_table) + STRUCT_ARRAY(int, default_properties_count, zval_ptr_nullable, default_properties_table) PROCESS(int, default_properties_count) - STRUCT_ARRAY(default_static_members_count, zval_ptr_nullable, default_static_members_table) + STRUCT_ARRAY(int, default_static_members_count, zval_ptr_nullable, default_static_members_table) PROCESS(int, default_static_members_count) IFCOPY(`dst->static_members_table = dst->default_static_members_table;') DONE(static_members_table) @@ -410,8 +410,8 @@ DEF_STRUCT_P_FUNC(`zend_class_entry', , `dnl {{{ dnl runtime binding: ADD_TRAIT will deal with it COPYNULL(traits) COPYZERO(num_traits) - STRUCT_ARRAY(, zend_trait_alias_ptr, trait_aliases) - STRUCT_ARRAY(, zend_trait_precedence_ptr, trait_precedences) + STRUCT_ARRAY(, , zend_trait_alias_ptr, trait_aliases) + STRUCT_ARRAY(, , zend_trait_precedence_ptr, trait_precedences) # endif #else IFRESTORE(` @@ -715,7 +715,7 @@ DEF_STRUCT_P_FUNC(`zend_op_array', , `dnl {{{ /* deep */ STRUCT_P(HashTable, static_variables, HashTable_zval_ptr) #ifdef ZEND_ENGINE_2 - STRUCT_ARRAY(num_args, zend_arg_info, arg_info) + STRUCT_ARRAY(zend_uint, num_args, zend_arg_info, arg_info) gc_arg_info = 1; #endif dst->filename = processor->entry_php_src->filepath; @@ -792,7 +792,7 @@ DEF_STRUCT_P_FUNC(`zend_op_array', , `dnl {{{ PROC_ZSTRING(, function_name) #ifdef ZEND_ENGINE_2 PROCESS(zend_uint, fn_flags) - STRUCT_ARRAY(num_args, zend_arg_info, arg_info) + STRUCT_ARRAY(zend_uint, num_args, zend_arg_info, arg_info) PROCESS(zend_uint, num_args) PROCESS(zend_uint, required_num_args) # ifndef ZEND_ENGINE_2_4 @@ -832,19 +832,19 @@ DEF_STRUCT_P_FUNC(`zend_op_array', , `dnl {{{ #ifdef ZEND_ENGINE_2_4 dnl used when copying opcodes - STRUCT_ARRAY(last_literal, zend_literal, literals) + STRUCT_ARRAY(int, last_literal, zend_literal, literals) PROCESS(int, last_literal) #endif dnl uses literals - STRUCT_ARRAY(last, zend_op, opcodes) + STRUCT_ARRAY(zend_uint, last, zend_op, opcodes) PROCESS(zend_uint, last) #ifndef ZEND_ENGINE_2_4 IFCOPY(`dst->size = src->last;DONE(size)', `PROCESS(zend_uint, size)') #endif #ifdef IS_CV - STRUCT_ARRAY(last_var, zend_compiled_variable, vars) + STRUCT_ARRAY(int, last_var, zend_compiled_variable, vars) PROCESS(int, last_var) # ifndef ZEND_ENGINE_2_4 IFCOPY(`dst->size_var = src->last_var;DONE(size_var)', `PROCESS(zend_uint, size_var)') @@ -858,8 +858,8 @@ DEF_STRUCT_P_FUNC(`zend_op_array', , `dnl {{{ PROCESS(zend_uint, T) - STRUCT_ARRAY(last_brk_cont, zend_brk_cont_element, brk_cont_array) - PROCESS(zend_uint, last_brk_cont) + STRUCT_ARRAY(last_brk_cont_t, last_brk_cont, zend_brk_cont_element, brk_cont_array) + PROCESS(last_brk_cont_t, last_brk_cont) #ifndef ZEND_ENGINE_2_4 PROCESS(zend_uint, current_brk_cont) #endif @@ -868,7 +868,7 @@ DEF_STRUCT_P_FUNC(`zend_op_array', , `dnl {{{ #endif #ifdef ZEND_ENGINE_2 - STRUCT_ARRAY(last_try_catch, zend_try_catch_element, try_catch_array) + STRUCT_ARRAY(int, last_try_catch, zend_try_catch_element, try_catch_array) PROCESS(int, last_try_catch) #endif @@ -996,10 +996,10 @@ dnl }}} DEF_STRUCT_P_FUNC(`xc_op_array_info_t', , `dnl {{{ #ifdef ZEND_ENGINE_2_4 PROCESS(zend_uint, literalinfo_cnt) - STRUCT_ARRAY(literalinfo_cnt, xc_op_array_info_detail_t, literalinfos) + STRUCT_ARRAY(zend_uint, literalinfo_cnt, xc_op_array_info_detail_t, literalinfos) #else PROCESS(zend_uint, oplineinfo_cnt) - STRUCT_ARRAY(oplineinfo_cnt, xc_op_array_info_detail_t, oplineinfos) + STRUCT_ARRAY(zend_uint, oplineinfo_cnt, xc_op_array_info_detail_t, oplineinfos) #endif ') dnl }}} @@ -1034,7 +1034,7 @@ DEF_STRUCT_P_FUNC(`xc_classinfo_t', , `dnl {{{ PROCESS(ulong, h) PROCESS(zend_uint, methodinfo_cnt) IFRESTORE(`COPY(methodinfos)', ` - STRUCT_ARRAY(methodinfo_cnt, xc_op_array_info_t, methodinfos) + STRUCT_ARRAY(zend_uint, methodinfo_cnt, xc_op_array_info_t, methodinfos) ') IFRESTORE(` processor->active_op_array_infos_src = src->methodinfos; @@ -1102,20 +1102,20 @@ DEF_STRUCT_P_FUNC(`xc_entry_data_php_t', , `dnl {{{ #ifdef HAVE_XCACHE_CONSTANT PROCESS(zend_uint, constinfo_cnt) - STRUCT_ARRAY(constinfo_cnt, xc_constinfo_t, constinfos) + STRUCT_ARRAY(zend_uint, constinfo_cnt, xc_constinfo_t, constinfos) #endif PROCESS(zend_uint, funcinfo_cnt) - STRUCT_ARRAY(funcinfo_cnt, xc_funcinfo_t, funcinfos) + STRUCT_ARRAY(zend_uint, funcinfo_cnt, xc_funcinfo_t, funcinfos) PROCESS(zend_uint, classinfo_cnt) - STRUCT_ARRAY(classinfo_cnt, xc_classinfo_t, classinfos, , IFRESTORE(`processor->active_class_index')) + STRUCT_ARRAY(zend_uint, classinfo_cnt, xc_classinfo_t, classinfos, , IFRESTORE(`processor->active_class_index')) #ifdef ZEND_ENGINE_2_1 PROCESS(zend_uint, autoglobal_cnt) IFRESTORE(` COPY(autoglobals) ', ` - STRUCT_ARRAY(autoglobal_cnt, xc_autoglobal_t, autoglobals) + STRUCT_ARRAY(zend_uint, autoglobal_cnt, xc_autoglobal_t, autoglobals) ') #endif #ifdef E_STRICT @@ -1123,7 +1123,7 @@ DEF_STRUCT_P_FUNC(`xc_entry_data_php_t', , `dnl {{{ IFRESTORE(` COPY(compilererrors) ', ` - STRUCT_ARRAY(compilererror_cnt, xc_compilererror_t, compilererrors) + STRUCT_ARRAY(zend_uint, compilererror_cnt, xc_compilererror_t, compilererrors) ') #endif #ifndef ZEND_COMPILE_DELAYED_BINDING diff --git a/processor/struct.m4 b/processor/struct.m4 index daa00d7..3e375b4 100644 --- a/processor/struct.m4 +++ b/processor/struct.m4 @@ -171,61 +171,61 @@ define(`STRUCT', ` DONE(`$2') ') dnl }}} -dnl {{{ STRUCT_ARRAY(1:count, 2:type, 3:elm, 4:name=type, 5:loopcounter) +dnl {{{ STRUCT_ARRAY(1:count_type, 2:count, 3:type, 4:elm, 5:name=type, 6:loopcounter) define(`STRUCT_ARRAY', ` - if (SRC(`$3')) { + if (SRC(`$4')) { ifelse( - `$5', `', `int i; pushdef(`LOOPCOUNTER', `i')', - `', `', `pushdef(`LOOPCOUNTER', `$5')') - pushdefFUNC_NAME(`$2', `$4') + `$6', `', `ifelse(`$1', `', `size_t', `$1') i; pushdef(`LOOPCOUNTER', `i')', + `', `', `pushdef(`LOOPCOUNTER', `$6')') + pushdefFUNC_NAME(`$3', `$5') IFDASM(` zval *arr; ALLOC_INIT_ZVAL(arr); array_init(arr); for (LOOPCOUNTER = 0; - ifelse(`$1', `', `SRC(`$3[LOOPCOUNTER]')', - `', `', `LOOPCOUNTER < SRC(`$1')'); + ifelse(`$2', `', `SRC(`$4[LOOPCOUNTER]')', + `', `', `LOOPCOUNTER < SRC(`$2')'); ++LOOPCOUNTER) { zval *zv; ALLOC_INIT_ZVAL(zv); array_init(zv); - FUNC_NAME (zv, &(SRC(`$3[LOOPCOUNTER]')) TSRMLS_CC); + FUNC_NAME (zv, &(SRC(`$4[LOOPCOUNTER]')) TSRMLS_CC); add_next_index_zval(arr, zv); } - add_assoc_zval_ex(dst, ZEND_STRS("$3"), arr); + add_assoc_zval_ex(dst, ZEND_STRS("$4"), arr); ', ` dnl find count with NULL - ifelse(`$1', `', ` + ifelse(`$2', `', ` size_t count = 0; - while (SRC(`$3[count]')) { + while (SRC(`$4[count]')) { ++count; } ++count; pushdef(`ARRAY_ELEMENT_COUNT', `count') ', - `', `', `pushdef(`ARRAY_ELEMENT_COUNT', `SRC(`$1')')') - ALLOC(`dst->$3', `$2', `ARRAY_ELEMENT_COUNT') + `', `', `pushdef(`ARRAY_ELEMENT_COUNT', `SRC(`$2')')') + ALLOC(`dst->$4', `$3', `ARRAY_ELEMENT_COUNT') popdef(`ARRAY_ELEMENT_COUNT') for (LOOPCOUNTER = 0; - ifelse(`$1', `', `SRC(`$3[LOOPCOUNTER]')', - `', `', `LOOPCOUNTER < SRC(`$1')'); + ifelse(`$2', `', `SRC(`$4[LOOPCOUNTER]')', + `', `', `LOOPCOUNTER < SRC(`$2')'); ++LOOPCOUNTER) { DISABLECHECK(` - STRUCT(`$2', `$3[LOOPCOUNTER]', `$4') + STRUCT(`$3', `$4[LOOPCOUNTER]', `$5') ') } dnl the end marker - ifelse(`$1', `', `IFCOPY(`DST(`$3[LOOPCOUNTER]') = NULL;')') + ifelse(`$2', `', `IFCOPY(`DST(`$4[LOOPCOUNTER]') = NULL;')') ')dnl IFDASM - DONE(`$3') + DONE(`$4') popdef(`FUNC_NAME') popdef(`LOOPCOUNTER') } else { - COPYNULL(`$3') + COPYNULL(`$4') } ') dnl }}} diff --git a/utils.c b/utils.c index 2d09501..001ea77 100644 --- a/utils.c +++ b/utils.c @@ -175,7 +175,7 @@ int xc_undo_pass_two(zend_op_array *op_array TSRMLS_DC) /* {{{ */ case ZEND_GOTO: #endif case ZEND_JMP: - assert(Z_OP(opline->op1).jmp_addr >= op_array->opcodes && Z_OP(opline->op1).jmp_addr - op_array->opcodes < op_array->last); + assert(Z_OP(opline->op1).jmp_addr >= op_array->opcodes && (zend_uint) (Z_OP(opline->op1).jmp_addr - op_array->opcodes) < op_array->last); Z_OP(opline->op1).opline_num = Z_OP(opline->op1).jmp_addr - op_array->opcodes; break; case ZEND_JMPZ: @@ -188,7 +188,7 @@ int xc_undo_pass_two(zend_op_array *op_array TSRMLS_DC) /* {{{ */ #ifdef ZEND_JMP_SET_VAR case ZEND_JMP_SET_VAR: #endif - assert(Z_OP(opline->op2).jmp_addr >= op_array->opcodes && Z_OP(opline->op2).jmp_addr - op_array->opcodes < op_array->last); + assert(Z_OP(opline->op2).jmp_addr >= op_array->opcodes && (zend_uint) (Z_OP(opline->op2).jmp_addr - op_array->opcodes) < op_array->last); Z_OP(opline->op2).opline_num = Z_OP(opline->op2).jmp_addr - op_array->opcodes; break; } diff --git a/xcache.c b/xcache.c index b09027a..d6838f5 100644 --- a/xcache.c +++ b/xcache.c @@ -37,7 +37,7 @@ #include "opcode_spec.h" #include "utils.h" -#define VAR_ENTRY_EXPIRED(pentry) ((pentry)->ttl && XG(request_time) > (pentry)->ctime + (pentry)->ttl) +#define VAR_ENTRY_EXPIRED(pentry) ((pentry)->ttl && XG(request_time) > (pentry)->ctime + (time_t) (pentry)->ttl) #define CHECK(x, e) do { if ((x) == NULL) { zend_error(E_ERROR, "XCache: " e); goto err; } } while (0) #define LOCK(x) xc_lock((x)->lck) #define UNLOCK(x) xc_unlock((x)->lck) @@ -463,7 +463,7 @@ static void xc_entry_apply_unlocked(xc_entry_type_t type, xc_cache_t *cache, cac static XC_ENTRY_APPLY_FUNC(xc_gc_expires_php_entry_unlocked) /* {{{ */ { TRACE("ttl %lu, %lu %lu", (zend_ulong) XG(request_time), (zend_ulong) entry->atime, xc_php_ttl); - if (XG(request_time) > entry->atime + xc_php_ttl) { + if (XG(request_time) > entry->atime + (time_t) xc_php_ttl) { return 1; } return 0; @@ -480,9 +480,9 @@ static XC_ENTRY_APPLY_FUNC(xc_gc_expires_var_entry_unlocked) /* {{{ */ static void xc_gc_expires_one(xc_entry_type_t type, xc_cache_t *cache, zend_ulong gc_interval, cache_apply_unlocked_func_t apply_func TSRMLS_DC) /* {{{ */ { TRACE("interval %lu, %lu %lu", (zend_ulong) XG(request_time), (zend_ulong) cache->last_gc_expires, gc_interval); - if (XG(request_time) - cache->last_gc_expires >= gc_interval) { + if (XG(request_time) >= cache->last_gc_expires + (time_t) gc_interval) { ENTER_LOCK(cache) { - if (XG(request_time) - cache->last_gc_expires >= gc_interval) { + if (XG(request_time) >= cache->last_gc_expires + (time_t) gc_interval) { cache->last_gc_expires = XG(request_time); xc_entry_apply_unlocked(type, cache, apply_func TSRMLS_CC); } @@ -1191,7 +1191,7 @@ static int xc_entry_data_php_init_md5(xc_cache_t *cache, xc_compiler_t *compiler php_stream *stream; ulong old_rsid = EG(regular_list).nNextFreeElement; - stream = php_stream_open_wrapper(ZEND_24(NOTHING, (char *)) compiler->filename, "rb", USE_PATH | REPORT_ERRORS | ENFORCE_SAFE_MODE | STREAM_DISABLE_OPEN_BASEDIR, NULL); + stream = php_stream_open_wrapper((char *) compiler->filename, "rb", USE_PATH | REPORT_ERRORS | ENFORCE_SAFE_MODE | STREAM_DISABLE_OPEN_BASEDIR, NULL); if (!stream) { return FAILURE; } @@ -1239,7 +1239,8 @@ static void xc_entry_php_init(xc_entry_php_t *entry_php, const char *filepath TS static void xc_cache_early_binding_class_cb(zend_op *opline, int oplineno, void *data TSRMLS_DC) /* {{{ */ { char *class_name; - int i, class_len; + zend_uint i; + int class_len; xc_cest_t cest; xc_entry_data_php_t *php = (xc_entry_data_php_t *) data; @@ -1284,7 +1285,11 @@ typedef struct { /* }}} */ static void xc_collect_op_array_info(xc_compiler_t *compiler, xc_const_usage_t *usage, xc_op_array_info_t *op_array_info, zend_op_array *op_array TSRMLS_DC) /* {{{ */ { - int i; +#ifdef ZEND_ENGINE_2_4 + int literalindex; +#else + zend_uint oplinenum; +#endif xc_vector_t details; xc_vector_init(xc_op_array_info_detail_t, &details); @@ -1314,8 +1319,8 @@ static void xc_collect_op_array_info(xc_compiler_t *compiler, xc_const_usage_t * } #ifdef ZEND_ENGINE_2_4 - for (i = 0; i < op_array->last_literal; i++) { - zend_literal *literal = &op_array->literals[i]; + for (literalindex = 0; literalindex < op_array->last_literal; literalindex++) { + zend_literal *literal = &op_array->literals[literalindex]; zend_uint literalinfo = 0; if (Z_TYPE(literal->constant) == IS_STRING) { XCACHE_ANALYZE_LITERAL(file) @@ -1329,7 +1334,7 @@ static void xc_collect_op_array_info(xc_compiler_t *compiler, xc_const_usage_t * #endif if (literalinfo) { xc_op_array_info_detail_t detail; - detail.index = i; + detail.index = literalindex; detail.info = literalinfo; xc_vector_add(xc_op_array_info_detail_t, &details, detail); } @@ -1338,8 +1343,8 @@ static void xc_collect_op_array_info(xc_compiler_t *compiler, xc_const_usage_t * op_array_info->literalinfo_cnt = details.cnt; op_array_info->literalinfos = xc_vector_detach(xc_op_array_info_detail_t, &details); #else /* ZEND_ENGINE_2_4 */ - for (i = 0; i < op_array->last; i++) { - zend_op *opline = &op_array->opcodes[i]; + for (oplinenum = 0; oplinenum < op_array->last; oplinenum++) { + zend_op *opline = &op_array->opcodes[oplinenum]; zend_uint oplineinfo = 0; if (Z_OP_TYPE(opline->op1) == IS_CONST) { if (Z_TYPE(Z_OP_CONSTANT(opline->op1)) == IS_STRING) { @@ -1369,7 +1374,7 @@ static void xc_collect_op_array_info(xc_compiler_t *compiler, xc_const_usage_t * if (oplineinfo) { xc_op_array_info_detail_t detail; - detail.index = i; + detail.index = oplinenum; detail.info = oplineinfo; xc_vector_add(xc_op_array_info_detail_t, &details, detail); } @@ -1383,12 +1388,12 @@ static void xc_collect_op_array_info(xc_compiler_t *compiler, xc_const_usage_t * /* }}} */ void xc_fix_op_array_info(const xc_entry_php_t *entry_php, const xc_entry_data_php_t *php, zend_op_array *op_array, int shallow_copy, const xc_op_array_info_t *op_array_info TSRMLS_DC) /* {{{ */ { - int i; - #ifdef ZEND_ENGINE_2_4 - for (i = 0; i < op_array_info->literalinfo_cnt; ++i) { - int index = op_array_info->literalinfos[i].index; - int literalinfo = op_array_info->literalinfos[i].info; + int linteralindex; + + for (linteralindex = 0; linteralindex < op_array_info->literalinfo_cnt; ++linteralindex) { + int index = op_array_info->literalinfos[linteralindex].index; + int literalinfo = op_array_info->literalinfos[linteralindex].info; zend_literal *literal = &op_array->literals[index]; if ((literalinfo & xcache_literal_is_file)) { if (!shallow_copy) { @@ -1429,10 +1434,12 @@ void xc_fix_op_array_info(const xc_entry_php_t *entry_php, const xc_entry_data_p } } } -#else - for (i = 0; i < op_array_info->oplineinfo_cnt; ++i) { - int oplineno = op_array_info->oplineinfos[i].index; - int oplineinfo = op_array_info->oplineinfos[i].info; +#else /* ZEND_ENGINE_2_4 */ + zend_uint oplinenum; + + for (oplinenum = 0; oplinenum < op_array_info->oplineinfo_cnt; ++oplinenum) { + int oplineno = op_array_info->oplineinfos[oplinenum].index; + int oplineinfo = op_array_info->oplineinfos[oplinenum].info; zend_op *opline = &op_array->opcodes[oplineno]; if ((oplineinfo & xcache_op1_is_file)) { assert(Z_OP_TYPE(opline->op1) == IS_CONST); @@ -1516,7 +1523,7 @@ void xc_fix_op_array_info(const xc_entry_php_t *entry_php, const xc_entry_data_p } } } -#endif +#endif /* ZEND_ENGINE_2_4 */ } /* }}} */ static void xc_free_op_array_info(xc_op_array_info_t *op_array_info TSRMLS_DC) /* {{{ */ @@ -1534,11 +1541,12 @@ static void xc_free_op_array_info(xc_op_array_info_t *op_array_info TSRMLS_DC) / /* }}} */ static void xc_free_php(xc_entry_data_php_t *php TSRMLS_DC) /* {{{ */ { - int i; + zend_uint i; if (php->classinfos) { for (i = 0; i < php->classinfo_cnt; i ++) { xc_classinfo_t *classinfo = &php->classinfos[i]; - int j; + zend_uint j; + for (j = 0; j < classinfo->methodinfo_cnt; j ++) { xc_free_op_array_info(&classinfo->methodinfos[j] TSRMLS_CC); } @@ -1575,7 +1583,7 @@ static void xc_free_php(xc_entry_data_php_t *php TSRMLS_DC) /* {{{ */ static zend_op_array *xc_compile_php(xc_compiler_t *compiler, zend_file_handle *h, int type TSRMLS_DC) /* {{{ */ { zend_op_array *op_array; - int old_constinfo_cnt, old_funcinfo_cnt, old_classinfo_cnt; + zend_uint old_constinfo_cnt, old_funcinfo_cnt, old_classinfo_cnt; zend_bool catched = 0; /* {{{ compile */ @@ -1656,8 +1664,8 @@ static zend_op_array *xc_compile_php(xc_compiler_t *compiler, zend_file_handle * /* {{{ shallow copy, pointers only */ { Bucket *b; - unsigned int i; - unsigned int j; + zend_uint i; + zend_uint j; #define COPY_H(vartype, var, cnt, name, datatype) do { \ for (i = 0, j = 0; b; i ++, b = b->pListNext) { \ @@ -1778,7 +1786,7 @@ static zend_op_array *xc_compile_php(xc_compiler_t *compiler, zend_file_handle * /* {{{ find inherited classes that should be early-binding */ compiler->new_php.have_early_binding = 0; { - int i; + zend_uint i; for (i = 0; i < compiler->new_php.classinfo_cnt; i ++) { compiler->new_php.classinfos[i].oplineno = -1; } @@ -2124,7 +2132,7 @@ static zend_op_array *xc_compile_file(zend_file_handle *h, int type TSRMLS_DC) / int xc_is_rw(const void *p) /* {{{ */ { xc_shm_t *shm; - int i; + size_t i; if (xc_php_caches) { for (i = 0; i < xc_php_hcache.size; i ++) { @@ -2149,7 +2157,7 @@ int xc_is_rw(const void *p) /* {{{ */ int xc_is_ro(const void *p) /* {{{ */ { xc_shm_t *shm; - int i; + size_t i; if (xc_php_caches) { for (i = 0; i < xc_php_hcache.size; i ++) { @@ -2248,7 +2256,7 @@ static int xc_init_constant(int module_number TSRMLS_DC) /* {{{ */ /* }}} */ static xc_shm_t *xc_cache_destroy(xc_cache_t **caches, xc_hash_t *hcache) /* {{{ */ { - int i; + size_t i; xc_cache_t *cache; xc_shm_t *shm; @@ -2281,7 +2289,7 @@ static xc_cache_t **xc_cache_init(xc_shm_t *shm, xc_hash_t *hcache, xc_hash_t *h xc_cache_t **caches = NULL, *cache; xc_mem_t *mem; time_t now = time(NULL); - int i; + size_t i; xc_memsize_t memsize; memsize = shmsize / hcache->size; @@ -2404,7 +2412,7 @@ err: /* }}} */ static void xc_request_init(TSRMLS_D) /* {{{ */ { - int i; + size_t i; if (!XG(internal_table_copied)) { zend_function tmp_func; @@ -2498,7 +2506,7 @@ PHP_GSHUTDOWN_FUNCTION(xcache) void xc_shutdown_globals(zend_xcache_globals* xcache_globals TSRMLS_DC) #endif { - int i; + size_t i; if (xcache_globals->php_holds != NULL) { for (i = 0; i < xc_php_hcache.size; i ++) { @@ -3714,7 +3722,7 @@ static int xc_zend_remove_extension(zend_extension *extension) /* {{{ */ /* }}} */ static int xc_config_hash(xc_hash_t *p, char *name, char *default_value) /* {{{ */ { - int bits, size; + size_t bits, size; char *value; if (cfg_get_string(name, &value) != SUCCESS) { diff --git a/xcache.h b/xcache.h index a66632a..153d01e 100644 --- a/xcache.h +++ b/xcache.h @@ -226,9 +226,9 @@ typedef const zstr const_zstr; typedef ulong xc_hash_value_t; typedef struct { - int bits; - int size; - int mask; + size_t bits; + size_t size; + xc_hash_value_t mask; } xc_hash_t; /* the class entry type to be stored in class_table */ @@ -419,7 +419,7 @@ struct _xc_entry_t { time_t atime; /* access atime of this entry */ time_t dtime; /* deletion time of this entry */ zend_ulong hits; - long ttl; + zend_ulong ttl; xc_entry_name_t name; };