Changeset 846
Legend:
- Unmodified
- Added
- Removed
-
trunk/processor/head.m4
r844 r846 179 179 #define C_RELAYLINE , __LINE__ 180 180 ') 181 static inline void xc_calc_string_n(xc_processor_t *processor, zend_uchar type, const_zstr conststr, long size IFASSERT(`, int relayline')) {181 static inline void xc_calc_string_n(xc_processor_t *processor, zend_uchar type, const_zstr str, long size IFASSERT(`, int relayline')) { 182 182 pushdef(`__LINE__', `relayline') 183 183 int realsize = UNISW(size, (type == IS_UNICODE) ? UBYTES(size) : size); … … 201 201 /* {{{ xc_store_string_n */ 202 202 REDEF(`KIND', `store') 203 static inline zstr xc_store_string_n(xc_processor_t *processor, zend_uchar type, const_zstr conststr, long size IFASSERT(`, int relayline')) {203 static inline zstr xc_store_string_n(xc_processor_t *processor, zend_uchar type, const_zstr str, long size IFASSERT(`, int relayline')) { 204 204 pushdef(`__LINE__', `relayline') 205 205 int realsize = UNISW(size, (type == IS_UNICODE) ? UBYTES(size) : size); -
trunk/processor/processor.m4
r844 r846 411 411 COPYNULL(traits) 412 412 COPYZERO(num_traits) 413 STRUCT_ARRAY(, zend_trait_alias_ptr, trait_aliases) 414 STRUCT_ARRAY(, zend_trait_precedence_ptr, trait_precedences) 413 415 # endif 414 416 #else … … 426 428 PROCESS(zend_uint, num_interfaces) 427 429 #endif 428 STRUCT_ARRAY(, zend_trait_alias_ptr, trait_aliases)429 STRUCT_ARRAY(, zend_trait_precedence_ptr, trait_precedences)430 430 431 431 # ifdef ZEND_ENGINE_2_4 -
trunk/utils.c
r829 r846 482 482 483 483 #ifdef HAVE_XCACHE_CONSTANT 484 void xc_install_constant( char *filename, zend_constant *constant, zend_uchar type,zstr key, uint len, ulong h TSRMLS_DC) /* {{{ */484 void xc_install_constant(ZEND_24(const) char *filename, zend_constant *constant, zend_uchar type, const24_zstr key, uint len, ulong h TSRMLS_DC) /* {{{ */ 485 485 { 486 486 if (zend_u_hash_add(EG(zend_constants), type, key, len, … … 502 502 /* }}} */ 503 503 #endif 504 void xc_install_function( char *filename, zend_function *func, zend_uchar type,zstr key, uint len, ulong h TSRMLS_DC) /* {{{ */504 void xc_install_function(ZEND_24(const) char *filename, zend_function *func, zend_uchar type, const24_zstr key, uint len, ulong h TSRMLS_DC) /* {{{ */ 505 505 { 506 506 zend_bool istmpkey; … … 532 532 } 533 533 /* }}} */ 534 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) /* {{{ */534 ZESW(xc_cest_t *, void) xc_install_class(ZEND_24(const) char *filename, xc_cest_t *cest, int oplineno, zend_uchar type, const24_zstr key, uint len, ulong h TSRMLS_DC) /* {{{ */ 535 535 { 536 536 zend_bool istmpkey; … … 630 630 #endif 631 631 #ifdef ZEND_ENGINE_2_1 632 static zend_bool xc_auto_global_callback( char *name, uint name_len TSRMLS_DC) /* {{{ */632 static zend_bool xc_auto_global_callback(ZEND_24(const) char *name, uint name_len TSRMLS_DC) /* {{{ */ 633 633 { 634 634 return 0; … … 710 710 /* }}} */ 711 711 #endif 712 xc_sandbox_t *xc_sandbox_init(xc_sandbox_t *sandbox, char *filename TSRMLS_DC) /* {{{ */712 xc_sandbox_t *xc_sandbox_init(xc_sandbox_t *sandbox, ZEND_24(const) char *filename TSRMLS_DC) /* {{{ */ 713 713 { 714 714 HashTable *h; -
trunk/utils.h
r671 r846 69 69 /* installer */ 70 70 #ifdef HAVE_XCACHE_CONSTANT 71 void xc_install_constant( char *filename, zend_constant *constant, zend_uchar type,zstr key, uint len, ulong h TSRMLS_DC);71 void xc_install_constant(ZEND_24(const) char *filename, zend_constant *constant, zend_uchar type, const24_zstr key, uint len, ulong h TSRMLS_DC); 72 72 #endif 73 void xc_install_function( char *filename, zend_function *func, zend_uchar type,zstr key, uint len, ulong h TSRMLS_DC);74 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);73 void xc_install_function(ZEND_24(const) char *filename, zend_function *func, zend_uchar type, const24_zstr key, uint len, ulong h TSRMLS_DC); 74 ZESW(xc_cest_t *, void) xc_install_class(ZEND_24(const) char *filename, xc_cest_t *cest, int oplineno, zend_uchar type, const24_zstr key, uint len, ulong h TSRMLS_DC); 75 75 76 76 #if defined(E_STRICT) || defined(E_DEPRECATED) … … 81 81 typedef struct { 82 82 int alloc; 83 char *filename;83 ZEND_24(const) char *filename; 84 84 85 85 HashTable orig_included_files; … … 122 122 123 123 void xc_zend_class_add_ref(zend_class_entry ZESW(*ce, **ce)); 124 xc_sandbox_t *xc_sandbox_init(xc_sandbox_t *sandbox, char *filename TSRMLS_DC);124 xc_sandbox_t *xc_sandbox_init(xc_sandbox_t *sandbox, ZEND_24(const) char *filename TSRMLS_DC); 125 125 void xc_sandbox_free(xc_sandbox_t *sandbox, xc_install_action_t install TSRMLS_DC); 126 126 -
trunk/xcache.c
r840 r846 38 38 #include "utils.h" 39 39 40 #define VAR_ENTRY_EXPIRED(pentry) ((pentry)->ttl && XG(request_time) > pentry->ctime + (pentry)->ttl)40 #define VAR_ENTRY_EXPIRED(pentry) ((pentry)->ttl && XG(request_time) > (pentry)->ctime + (pentry)->ttl) 41 41 #define CHECK(x, e) do { if ((x) == NULL) { zend_error(E_ERROR, "XCache: " e); goto err; } } while (0) 42 #define LOCK(x) xc_lock( x->lck)43 #define UNLOCK(x) xc_unlock( x->lck)42 #define LOCK(x) xc_lock((x)->lck) 43 #define UNLOCK(x) xc_unlock((x)->lck) 44 44 45 45 #define ENTER_LOCK_EX(x) \ 46 xc_lock( x->lck); \46 xc_lock((x)->lck); \ 47 47 zend_try { \ 48 48 do … … 52 52 catched = 1; \ 53 53 } zend_end_try(); \ 54 xc_unlock( x->lck)54 xc_unlock((x)->lck) 55 55 56 56 #define ENTER_LOCK(x) do { \ … … 859 859 /* fall back to current directory */ 860 860 if (zend_is_executing(TSRMLS_C)) { 861 c har *path= zend_get_executed_filename(TSRMLS_C);862 if ( path && path[0] != '[') {863 int len = strlen( path);864 while ((--len >= 0) && !IS_SLASH( path[len])) {861 const char *executed_filename = zend_get_executed_filename(TSRMLS_C); 862 if (executed_filename && executed_filename[0] != '[') { 863 int len = strlen(executed_filename); 864 while ((--len >= 0) && !IS_SLASH(executed_filename[len])) { 865 865 /* skipped */ 866 866 } 867 867 if (len > 0 && len + strlen(filename) + 1 < MAXPATHLEN - 1) { 868 strcpy(filepath, path);868 strcpy(filepath, executed_filename); 869 869 strcpy(filepath + len + 1, filename); 870 870 if (VCWD_STAT(filepath, pbuf) == 0) { … … 886 886 887 887 #define HASH(i) (i) 888 #define HASH_ZSTR_L(t, s, l) HASH(zend_u_inline_hash_func( t, s, (l+ 1) * sizeof(UChar)))889 #define HASH_STR_S(s, l) HASH(zend_inline_hash_func( s, l))890 #define HASH_STR_L(s, l) HASH_STR_S( s, l+ 1)891 #define HASH_STR(s) HASH_STR_L( s, strlen(s) + 1)888 #define HASH_ZSTR_L(t, s, l) HASH(zend_u_inline_hash_func((t), (s), ((l) + 1) * sizeof(UChar))) 889 #define HASH_STR_S(s, l) HASH(zend_inline_hash_func((s), (l))) 890 #define HASH_STR_L(s, l) HASH_STR_S((s), (l) + 1) 891 #define HASH_STR(s) HASH_STR_L((s), strlen((s)) + 1) 892 892 #define HASH_NUM(n) HASH(n) 893 893 static inline xc_hash_value_t xc_hash_fold(xc_hash_value_t hvalue, const xc_hash_t *hasher) /* {{{ fold hash bits as needed */ … … 962 962 /* }}} */ 963 963 964 static int xc_entry_init_key_php(xc_entry_t *xce, c har *filename TSRMLS_DC) /* {{{ */964 static int xc_entry_init_key_php(xc_entry_t *xce, const char *filename TSRMLS_DC) /* {{{ */ 965 965 { 966 966 char opened_path_buffer[MAXPATHLEN]; 967 struct stat buf, *pbuf;968 xc_hash_value_t hv;969 967 int cacheid; 970 xc_entry_data_php_t *php;971 char *ptr;972 time_t delta;973 968 974 969 if (!filename || !SG(request_info).path_translated) { … … 980 975 } 981 976 982 php = xce->data.php;983 984 977 if (XG(stat)) { 978 struct stat buf, *pbuf; 979 985 980 if (strcmp(SG(request_info).path_translated, filename) == 0) { 986 981 /* sapi has already done this stat() for us */ … … 1002 997 /* relative path */ 1003 998 if (*filename == '.' && (IS_SLASH(filename[1]) || filename[1] == '.')) { 1004 ptr = filename + 1;999 const char *ptr = filename + 1; 1005 1000 if (*ptr == '.') { 1006 1001 while (*(++ptr) == '.'); … … 1025 1020 1026 1021 stat_done: 1027 delta = XG(request_time) - pbuf->st_mtime; 1028 if (abs(delta) < 2 && !xc_test) { 1029 return FAILURE; 1022 { 1023 time_t delta = XG(request_time) - pbuf->st_mtime; 1024 if (abs(delta) < 2 && !xc_test) { 1025 return FAILURE; 1026 } 1030 1027 } 1031 1028 … … 1035 1032 xce->inode = pbuf->st_ino; 1036 1033 #endif 1037 php->sourcesize= pbuf->st_size;1034 xce->data.php->sourcesize = pbuf->st_size; 1038 1035 } 1039 1036 else { /* XG(inode) */ … … 1043 1040 xce->inode = 0; 1044 1041 #endif 1045 php->sourcesize= 0;1042 xce->data.php->sourcesize = 0; 1046 1043 } 1047 1044 … … 1059 1056 1060 1057 UNISW(NOTHING, xce->name_type = IS_STRING;) 1061 xce->name.str.val = filename;1058 xce->name.str.val = (char *) filename; 1062 1059 xce->name.str.len = strlen(filename); 1063 1060 1064 if (xc_php_hcache.size > 1) { 1065 hv = xc_entry_hash_php_basename(xce TSRMLS_CC); 1066 cacheid = xc_hash_fold(hv, &xc_php_hcache); 1067 } 1068 else { 1069 cacheid = 0; 1070 } 1061 cacheid = xc_php_hcache.size > 1 ? xc_hash_fold(xc_entry_hash_php_basename(xce TSRMLS_CC), &xc_php_hcache) : 0; 1071 1062 xce->cache = xc_php_caches[cacheid]; 1072 1073 hv = xc_entry_hash_php(xce TSRMLS_CC); 1074 xce->hvalue = xc_hash_fold(hv, &xc_php_hentry); 1075 1063 xce->hvalue = xc_hash_fold(xc_entry_hash_php(xce TSRMLS_CC), &xc_php_hentry); 1076 1064 xce->type = XC_TYPE_PHP; 1077 1078 1065 xce->filepath = NULL; 1079 1066 xce->dirpath = NULL; … … 1088 1075 static inline xc_hash_value_t xc_php_hash_md5(xc_entry_data_php_t *php TSRMLS_DC) /* {{{ */ 1089 1076 { 1090 return HASH_STR_S( &php->md5, sizeof(php->md5));1077 return HASH_STR_S(php->md5.digest, sizeof(php->md5)); 1091 1078 } 1092 1079 /* }}} */ … … 1097 1084 int n; 1098 1085 php_stream *stream; 1099 xc_hash_value_t hv;1100 1086 ulong old_rsid = EG(regular_list).nNextFreeElement; 1101 1087 … … 1120 1106 } 1121 1107 1122 hv = xc_php_hash_md5(php TSRMLS_CC);1123 1108 php->cache = xce->cache; 1124 php->hvalue = ( hv& php->cache->hphp->mask);1109 php->hvalue = (xc_php_hash_md5(php TSRMLS_CC) & php->cache->hphp->mask); 1125 1110 #ifdef XCACHE_DEBUG 1126 1111 { … … 1134 1119 } 1135 1120 /* }}} */ 1136 static void xc_entry_init_key_php_entry(xc_entry_t *xce, char *filepath TSRMLS_DC) /* {{{*/1121 static void xc_entry_init_key_php_entry(xc_entry_t *xce, ZEND_24(const) char *filepath TSRMLS_DC) /* {{{*/ 1137 1122 { 1138 1123 xce->filepath = filepath; … … 1518 1503 /* }}} */ 1519 1504 /* {{{ prepare */ 1520 zend_restore_compiled_filename(h->opened_path ? h->opened_path : h->filename TSRMLS_CC);1505 zend_restore_compiled_filename(h->opened_path ? h->opened_path : (char *) h->filename TSRMLS_CC); 1521 1506 php->op_array = op_array; 1522 1507 … … 1890 1875 */ 1891 1876 if (xce->inode) { 1892 c har *filename = h->opened_path ? h->opened_path : h->filename;1877 const char *filename = h->opened_path ? h->opened_path : h->filename; 1893 1878 if (xce->name.str.val != filename) { 1894 xce->name.str.val = filename;1879 xce->name.str.val = (char *) filename; 1895 1880 xce->name.str.len = strlen(filename); 1896 1881 } … … 1979 1964 xc_entry_t xce; 1980 1965 xc_entry_data_php_t php; 1981 c har *filename;1966 const char *filename; 1982 1967 1983 1968 assert(xc_initized); -
trunk/xcache.h
r840 r846 41 41 #else 42 42 # define ZESW(v1, v2) v2 43 #endif 44 #ifdef ZEND_ENGINE_2_4 45 # define ZEND_24(x) x 46 #else 47 # define ZEND_24(x) 43 48 #endif 44 49 … … 150 155 typedef char *zstr; 151 156 typedef const char *const_zstr; 157 #ifdef ZEND_ENGINE_2_4 158 typedef const char *const24_zstr; 159 typedef const char *const24_str; 160 #else 161 typedef char *const24_zstr; 162 typedef char *const24_str; 163 #endif 164 152 165 # define ZSTR_S(s) (s) 153 166 # define ZSTR_U(s) (s) … … 292 305 typedef struct { 293 306 #ifdef IS_UNICODE 294 zend_uchar type;295 #endif 296 zstrkey;297 zend_uint key_size;298 ulong h;299 zend_uint methodinfo_cnt;307 zend_uchar type; 308 #endif 309 const24_zstr key; 310 zend_uint key_size; 311 ulong h; 312 zend_uint methodinfo_cnt; 300 313 xc_op_array_info_t *methodinfos; 301 xc_cest_t cest;314 xc_cest_t cest; 302 315 #ifndef ZEND_COMPILE_DELAYED_BINDING 303 int oplineno;316 int oplineno; 304 317 #endif 305 318 } xc_classinfo_t; … … 309 322 typedef struct { 310 323 #ifdef IS_UNICODE 311 zend_uchar type;312 #endif 313 zstrkey;314 zend_uint key_size;315 ulong h;324 zend_uchar type; 325 #endif 326 const24_zstr key; 327 zend_uint key_size; 328 ulong h; 316 329 zend_constant constant; 317 330 } xc_constinfo_t; … … 321 334 typedef struct { 322 335 #ifdef IS_UNICODE 323 zend_uchar type;324 #endif 325 zstrkey;326 zend_uint key_size;327 ulong h;336 zend_uchar type; 337 #endif 338 const24_zstr key; 339 zend_uint key_size; 340 ulong h; 328 341 xc_op_array_info_t op_array_info; 329 342 zend_function func; … … 334 347 typedef struct { 335 348 #ifdef IS_UNICODE 336 zend_uchar type;337 #endif 338 zstrkey;339 zend_uint key_len;340 ulong h;349 zend_uchar type; 350 #endif 351 const24_zstr key; 352 zend_uint key_len; 353 ulong h; 341 354 } xc_autoglobal_t; 342 355 /* }}} */ … … 438 451 /* php only */ 439 452 int filepath_len; 440 char*filepath;453 ZEND_24(const) char *filepath; 441 454 int dirpath_len; 442 455 char *dirpath;

