Changeset 11 for trunk/xcache.c
- Timestamp:
- 05/24/2006 09:52:48 AM (7 years ago)
- Files:
-
- 1 modified
-
trunk/xcache.c (modified) (25 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/xcache.c
r9 r11 27 27 #include "opcode_spec.h" 28 28 29 #undef NDEBUG 29 30 #ifdef DEBUG 30 # undef NDEBUG31 31 # undef inline 32 32 # define inline … … 340 340 for (i = 0, c = cache->hentry->size; i < c; i ++) { 341 341 for (e = cache->entries[i]; e; e = e->next) { 342 xc_fillentry_dmz(e, 0, list );342 xc_fillentry_dmz(e, 0, list TSRMLS_CC); 343 343 } 344 344 } … … 348 348 array_init(list); 349 349 for (e = cache->deletes; e; e = e->next) { 350 xc_fillentry_dmz(e, 1, list );350 xc_fillentry_dmz(e, 1, list TSRMLS_CC); 351 351 } 352 352 add_assoc_zval(return_value, "deleted_list", list); … … 402 402 int i; 403 403 xc_cache_t *cache; 404 typeof(cache->deletes) p, *last; 404 typedef xc_entry_t *xc_delete_t; 405 xc_delete_t p, *last; 405 406 406 407 for (i = 0; i < size; i ++) { … … 408 409 ENTER_LOCK(cache) { 409 410 if (cache->deletes) { 410 last = ( typeof(last)) &cache->deletes;411 last = (xc_delete_t *) &cache->deletes; 411 412 for (p = *last; p; p = p->next) { 412 413 if (t - p->dtime > 3600) { … … 433 434 } 434 435 /* }}} */ 435 static inline void xc_entry_unholds_real(xc_stack_t *holds, xc_cache_t **caches, int cachecount ) /* {{{ */436 static inline void xc_entry_unholds_real(xc_stack_t *holds, xc_cache_t **caches, int cachecount TSRMLS_DC) /* {{{ */ 436 437 { 437 438 int i; … … 457 458 static void xc_entry_unholds(TSRMLS_D) /* {{{ */ 458 459 { 459 xc_entry_unholds_real(XG(php_holds), xc_php_caches, xc_php_hcache.size );460 xc_entry_unholds_real(XG(var_holds), xc_var_caches, xc_var_hcache.size );461 } 462 /* }}} */ 463 static int xc_stat(const char *filename, const char *include_path, struct stat *pbuf ) /* {{{ */460 xc_entry_unholds_real(XG(php_holds), xc_php_caches, xc_php_hcache.size TSRMLS_CC); 461 xc_entry_unholds_real(XG(var_holds), xc_var_caches, xc_var_hcache.size TSRMLS_CC); 462 } 463 /* }}} */ 464 static int xc_stat(const char *filename, const char *include_path, struct stat *pbuf TSRMLS_DC) /* {{{ */ 464 465 { 465 466 char filepath[1024]; … … 472 473 memcpy(paths, include_path, size); 473 474 474 for (path = strtok_r(paths, tokens, &tokbuf); path; path =strtok_r(NULL, tokens, &tokbuf)) {475 for (path = php_strtok_r(paths, tokens, &tokbuf); path; path = php_strtok_r(NULL, tokens, &tokbuf)) { 475 476 if (strlen(path) + strlen(filename) + 1 > 1024) { 476 477 continue; … … 536 537 } 537 538 else { 538 if (xc_stat(filename, PG(include_path), pbuf ) != 0) {539 if (xc_stat(filename, PG(include_path), pbuf TSRMLS_CC) != 0) { 539 540 return 0; 540 541 } … … 825 826 static int xc_init_constant(int module_number TSRMLS_DC) /* {{{ */ 826 827 { 827 struct {828 typedef struct { 828 829 const char *prefix; 829 830 int (*getsize)(); 830 831 const char *(*get)(zend_uchar i); 831 } nameinfos[] = { 832 } xc_meminfo_t; 833 xc_meminfo_t nameinfos[] = { 832 834 { "", xc_get_op_type_count, xc_get_op_type }, 833 835 { "", xc_get_data_type_count, xc_get_data_type }, … … 836 838 { NULL, NULL, NULL } 837 839 }; 838 typeof(nameinfos[0])* p;840 xc_meminfo_t* p; 839 841 int i; 840 842 char const_name[96]; … … 861 863 } 862 864 /* }}} */ 863 static xc_shm_t *xc_cache_destroy(xc_cache_t **caches, xc_hash_t *hcache TSRMLS_DC) /* {{{ */865 static xc_shm_t *xc_cache_destroy(xc_cache_t **caches, xc_hash_t *hcache) /* {{{ */ 864 866 { 865 867 int i; … … 891 893 } 892 894 /* }}} */ 893 static xc_cache_t **xc_cache_init(xc_shm_t *shm, char *ptr, xc_hash_t *hcache, xc_hash_t *hentry, xc_shmsize_t shmsize TSRMLS_DC) /* {{{ */895 static xc_cache_t **xc_cache_init(xc_shm_t *shm, char *ptr, xc_hash_t *hcache, xc_hash_t *hentry, xc_shmsize_t shmsize) /* {{{ */ 894 896 { 895 897 xc_cache_t **caches = NULL, *cache; 896 898 xc_mem_t *mem; 897 899 int i; 900 898 901 xc_memsize_t memsize = shmsize / hcache->size; 899 902 … … 948 951 static int xc_init(int module_number TSRMLS_DC) /* {{{ */ 949 952 { 950 xc_php_caches = xc_var_caches = NULL;951 953 xc_shm_t *shm; 952 954 char *ptr; 955 956 xc_php_caches = xc_var_caches = NULL; 953 957 954 958 if (xc_php_size || xc_var_size) { … … 1057 1061 /* }}} */ 1058 1062 1059 #define NEED_INITIZED() do { \1060 if (!xc_initized) { \1061 php_error_docref(NULL TSRMLS_CC, E_WARNING, "XCache is not initized"); \1062 RETURN_FALSE; \1063 } \1064 } while (0)1065 1066 1063 /* user functions */ 1067 1064 /* {{{ xcache_op */ … … 1069 1066 static void xcache_op(xcache_op_type optype, INTERNAL_FUNCTION_PARAMETERS) 1070 1067 { 1071 NEED_INITIZED();1072 1068 long type; 1073 1069 int size; 1074 1070 xc_cache_t **caches, *cache; 1075 1071 long id = 0; 1072 1073 if (!xc_initized) { 1074 php_error_docref(NULL TSRMLS_CC, E_WARNING, "XCache is not initized"); 1075 RETURN_FALSE; 1076 } 1076 1077 1077 1078 if (optype == XC_OP_COUNT) { … … 1239 1240 } 1240 1241 else { 1241 xc_entry_remove_dmz(stored_xce );1242 xc_entry_remove_dmz(stored_xce TSRMLS_CC); 1242 1243 } 1243 1244 } … … 1266 1267 stored_xce = xc_entry_find_dmz(&xce TSRMLS_CC); 1267 1268 if (stored_xce) { 1268 xc_entry_remove_dmz(stored_xce );1269 xc_entry_remove_dmz(stored_xce TSRMLS_CC); 1269 1270 } 1270 1271 var.value = value; 1271 1272 var.etime = ttl ? XG(request_time) + ttl : TIME_MAX; 1272 RETVAL_BOOL(xc_entry_store_dmz(&xce ) != NULL ? 1 : 0);1273 RETVAL_BOOL(xc_entry_store_dmz(&xce TSRMLS_CC) != NULL ? 1 : 0); 1273 1274 } LEAVE_LOCK(xce.cache); 1274 1275 } … … 1297 1298 } 1298 1299 else { 1299 xc_entry_remove_dmz(stored_xce );1300 xc_entry_remove_dmz(stored_xce TSRMLS_CC); 1300 1301 } 1301 1302 } … … 1322 1323 stored_xce = xc_entry_find_dmz(&xce TSRMLS_CC); 1323 1324 if (stored_xce) { 1324 xc_entry_remove_dmz(stored_xce );1325 xc_entry_remove_dmz(stored_xce TSRMLS_CC); 1325 1326 RETVAL_TRUE; 1326 1327 } … … 1359 1360 fprintf(stderr, "incdec: expired\n"); 1360 1361 #endif 1361 xc_entry_remove_dmz(stored_xce );1362 xc_entry_remove_dmz(stored_xce TSRMLS_CC); 1362 1363 stored_xce = NULL; 1363 1364 } … … 1399 1400 xce.ctime = stored_xce->ctime; 1400 1401 xce.hits = stored_xce->hits; 1401 xc_entry_remove_dmz(stored_xce );1402 } 1403 xc_entry_store_dmz(&xce );1402 xc_entry_remove_dmz(stored_xce TSRMLS_CC); 1403 } 1404 xc_entry_store_dmz(&xce TSRMLS_CC); 1404 1405 1405 1406 } LEAVE_LOCK(xce.cache); … … 1492 1493 } 1493 1494 if (spec >= 0 && spec < count) { 1494 name = getter( spec);1495 name = getter((zend_uchar) spec); 1495 1496 if (name) { 1496 1497 /* RETURN_STRING */ … … 1540 1541 } 1541 1542 if (spec <= xc_get_opcode_spec_count()) { 1542 opspec = xc_get_opcode_spec( spec);1543 opspec = xc_get_opcode_spec((zend_uchar) spec); 1543 1544 if (opspec) { 1544 1545 array_init(return_value); … … 1886 1887 #endif 1887 1888 { 1889 TSRMLS_FETCH(); 1890 1888 1891 xc_request_shutdown(TSRMLS_C); 1889 1892 return SUCCESS;

