Changeset 11 in svn for trunk/xcache.c


Ignore:
Timestamp:
2006-05-24T09:52:48+02:00 (9 years ago)
Author:
Xuefer
Message:

make it build on windows vc compiler

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/xcache.c

    r9 r11  
    2727#include "opcode_spec.h"
    2828
     29#undef NDEBUG
    2930#ifdef DEBUG
    30 #   undef NDEBUG
    3131#   undef inline
    3232#   define inline
     
    340340    for (i = 0, c = cache->hentry->size; i < c; i ++) {
    341341        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);
    343343        }
    344344    }
     
    348348    array_init(list);
    349349    for (e = cache->deletes; e; e = e->next) {
    350         xc_fillentry_dmz(e, 1, list);
     350        xc_fillentry_dmz(e, 1, list TSRMLS_CC);
    351351    }
    352352    add_assoc_zval(return_value, "deleted_list", list);
     
    402402    int i;
    403403    xc_cache_t *cache;
    404     typeof(cache->deletes) p, *last;
     404    typedef xc_entry_t *xc_delete_t;
     405    xc_delete_t p, *last;
    405406
    406407    for (i = 0; i < size; i ++) {
     
    408409        ENTER_LOCK(cache) {
    409410            if (cache->deletes) {
    410                 last = (typeof(last)) &cache->deletes;
     411                last = (xc_delete_t *) &cache->deletes;
    411412                for (p = *last; p; p = p->next) {
    412413                    if (t - p->dtime > 3600) {
     
    433434}
    434435/* }}} */
    435 static inline void xc_entry_unholds_real(xc_stack_t *holds, xc_cache_t **caches, int cachecount) /* {{{ */
     436static inline void xc_entry_unholds_real(xc_stack_t *holds, xc_cache_t **caches, int cachecount TSRMLS_DC) /* {{{ */
    436437{
    437438    int i;
     
    457458static void xc_entry_unholds(TSRMLS_D) /* {{{ */
    458459{
    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/* }}} */
     464static int xc_stat(const char *filename, const char *include_path, struct stat *pbuf TSRMLS_DC) /* {{{ */
    464465{
    465466    char filepath[1024];
     
    472473    memcpy(paths, include_path, size);
    473474
    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)) {
    475476        if (strlen(path) + strlen(filename) + 1 > 1024) {
    476477            continue;
     
    536537        }
    537538        else {
    538             if (xc_stat(filename, PG(include_path), pbuf) != 0) {   
     539            if (xc_stat(filename, PG(include_path), pbuf TSRMLS_CC) != 0) {   
    539540                return 0;
    540541            }
     
    825826static int xc_init_constant(int module_number TSRMLS_DC) /* {{{ */
    826827{
    827     struct {
     828    typedef struct {
    828829        const char *prefix;
    829830        int (*getsize)();
    830831        const char *(*get)(zend_uchar i);
    831     } nameinfos[] = {
     832    } xc_meminfo_t;
     833    xc_meminfo_t nameinfos[] = {
    832834        { "",        xc_get_op_type_count,   xc_get_op_type   },
    833835        { "",        xc_get_data_type_count, xc_get_data_type },
     
    836838        { NULL, NULL, NULL }
    837839    };
    838     typeof(nameinfos[0])* p;
     840    xc_meminfo_t* p;
    839841    int i;
    840842    char const_name[96];
     
    861863}
    862864/* }}} */
    863 static xc_shm_t *xc_cache_destroy(xc_cache_t **caches, xc_hash_t *hcache TSRMLS_DC) /* {{{ */
     865static xc_shm_t *xc_cache_destroy(xc_cache_t **caches, xc_hash_t *hcache) /* {{{ */
    864866{
    865867    int i;
     
    891893}
    892894/* }}} */
    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) /* {{{ */
     895static xc_cache_t **xc_cache_init(xc_shm_t *shm, char *ptr, xc_hash_t *hcache, xc_hash_t *hentry, xc_shmsize_t shmsize) /* {{{ */
    894896{
    895897    xc_cache_t **caches = NULL, *cache;
    896898    xc_mem_t *mem;
    897899    int i;
     900
    898901    xc_memsize_t memsize = shmsize / hcache->size;
    899902
     
    948951static int xc_init(int module_number TSRMLS_DC) /* {{{ */
    949952{
    950     xc_php_caches = xc_var_caches = NULL;
    951953    xc_shm_t *shm;
    952954    char *ptr;
     955
     956    xc_php_caches = xc_var_caches = NULL;
    953957
    954958    if (xc_php_size || xc_var_size) {
     
    10571061/* }}} */
    10581062
    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 
    10661063/* user functions */
    10671064/* {{{ xcache_op */
     
    10691066static void xcache_op(xcache_op_type optype, INTERNAL_FUNCTION_PARAMETERS)
    10701067{
    1071     NEED_INITIZED();
    10721068    long type;
    10731069    int size;
    10741070    xc_cache_t **caches, *cache;
    10751071    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    }
    10761077
    10771078    if (optype == XC_OP_COUNT) {
     
    12391240            }
    12401241            else {
    1241                 xc_entry_remove_dmz(stored_xce);
     1242                xc_entry_remove_dmz(stored_xce TSRMLS_CC);
    12421243            }
    12431244        }
     
    12661267        stored_xce = xc_entry_find_dmz(&xce TSRMLS_CC);
    12671268        if (stored_xce) {
    1268             xc_entry_remove_dmz(stored_xce);
     1269            xc_entry_remove_dmz(stored_xce TSRMLS_CC);
    12691270        }
    12701271        var.value = value;
    12711272        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);
    12731274    } LEAVE_LOCK(xce.cache);
    12741275}
     
    12971298            }
    12981299            else {
    1299                 xc_entry_remove_dmz(stored_xce);
     1300                xc_entry_remove_dmz(stored_xce TSRMLS_CC);
    13001301            }
    13011302        }
     
    13221323        stored_xce = xc_entry_find_dmz(&xce TSRMLS_CC);
    13231324        if (stored_xce) {
    1324             xc_entry_remove_dmz(stored_xce);
     1325            xc_entry_remove_dmz(stored_xce TSRMLS_CC);
    13251326            RETVAL_TRUE;
    13261327        }
     
    13591360                fprintf(stderr, "incdec: expired\n");
    13601361#endif
    1361                 xc_entry_remove_dmz(stored_xce);
     1362                xc_entry_remove_dmz(stored_xce TSRMLS_CC);
    13621363                stored_xce = NULL;
    13631364            }
     
    13991400            xce.ctime = stored_xce->ctime;
    14001401            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);
    14041405
    14051406    } LEAVE_LOCK(xce.cache);
     
    14921493    }
    14931494    if (spec >= 0 && spec < count) {
    1494         name = getter(spec);
     1495        name = getter((zend_uchar) spec);
    14951496        if (name) {
    14961497            /* RETURN_STRING */
     
    15401541    }
    15411542    if (spec <= xc_get_opcode_spec_count()) {
    1542         opspec = xc_get_opcode_spec(spec);
     1543        opspec = xc_get_opcode_spec((zend_uchar) spec);
    15431544        if (opspec) {
    15441545            array_init(return_value);
     
    18861887#endif
    18871888{
     1889    TSRMLS_FETCH();
     1890
    18881891    xc_request_shutdown(TSRMLS_C);
    18891892    return SUCCESS;
Note: See TracChangeset for help on using the changeset viewer.