Changeset 865


Ignore:
Timestamp:
2012-03-29T08:14:57+02:00 (3 years ago)
Author:
moo
Message:

xce->entry rename

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/processor/head.m4

    r860 r865  
    482482}
    483483/* }}} */
    484 /* export: xc_entry_data_php_t *xc_processor_restore_xc_entry_data_php_t(const xc_entry_php_t *xce, xc_entry_data_php_t *dst, const xc_entry_data_php_t *src, zend_bool readonly_protection TSRMLS_DC); :export {{{ */
    485 xc_entry_data_php_t *xc_processor_restore_xc_entry_data_php_t(const xc_entry_php_t *xce, xc_entry_data_php_t *dst, const xc_entry_data_php_t *src, zend_bool readonly_protection TSRMLS_DC) {
     484/* export: xc_entry_data_php_t *xc_processor_restore_xc_entry_data_php_t(const xc_entry_php_t *entry_php, xc_entry_data_php_t *dst, const xc_entry_data_php_t *src, zend_bool readonly_protection TSRMLS_DC); :export {{{ */
     485xc_entry_data_php_t *xc_processor_restore_xc_entry_data_php_t(const xc_entry_php_t *entry_php, xc_entry_data_php_t *dst, const xc_entry_data_php_t *src, zend_bool readonly_protection TSRMLS_DC) {
    486486    xc_processor_t processor;
    487487
     
    492492        processor.reference = 1;
    493493    }
    494     processor.entry_php_src = xce;
     494    processor.entry_php_src = entry_php;
    495495
    496496    if (processor.reference) {
  • trunk/xcache.c

    r864 r865  
    276276}
    277277/* }}} */
    278 static void xc_entry_add_dmz(xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_t *xce) /* {{{ */
     278static void xc_entry_add_dmz(xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_t *entry) /* {{{ */
    279279{
    280280    xc_entry_t **head = &(cache->entries[entryslotid]);
    281     xce->next = *head;
    282     *head = xce;
     281    entry->next = *head;
     282    *head = entry;
    283283    cache->entries_count ++;
    284284}
    285285/* }}} */
    286 static xc_entry_t *xc_entry_store_dmz(xc_entry_type_t type, xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_t *xce TSRMLS_DC) /* {{{ */
    287 {
    288     xc_entry_t *stored_xce;
    289 
    290     xce->hits  = 0;
    291     xce->ctime = XG(request_time);
    292     xce->atime = XG(request_time);
    293     stored_xce = type == XC_TYPE_PHP
    294         ? (xc_entry_t *) xc_processor_store_xc_entry_php_t(cache, (xc_entry_php_t *) xce TSRMLS_CC)
    295         : (xc_entry_t *) xc_processor_store_xc_entry_var_t(cache, (xc_entry_var_t *) xce TSRMLS_CC);
    296     if (stored_xce) {
    297         xc_entry_add_dmz(cache, entryslotid, stored_xce);
    298         return stored_xce;
     286static xc_entry_t *xc_entry_store_dmz(xc_entry_type_t type, xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_t *entry TSRMLS_DC) /* {{{ */
     287{
     288    xc_entry_t *stored_entry;
     289
     290    entry->hits  = 0;
     291    entry->ctime = XG(request_time);
     292    entry->atime = XG(request_time);
     293    stored_entry = type == XC_TYPE_PHP
     294        ? (xc_entry_t *) xc_processor_store_xc_entry_php_t(cache, (xc_entry_php_t *) entry TSRMLS_CC)
     295        : (xc_entry_t *) xc_processor_store_xc_entry_var_t(cache, (xc_entry_var_t *) entry TSRMLS_CC);
     296    if (stored_entry) {
     297        xc_entry_add_dmz(cache, entryslotid, stored_entry);
     298        return stored_entry;
    299299    }
    300300    else {
     
    304304}
    305305/* }}} */
    306 static xc_entry_php_t *xc_entry_php_store_dmz(xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_php_t *xce TSRMLS_DC) /* {{{ */
    307 {
    308     return (xc_entry_php_t *) xc_entry_store_dmz(XC_TYPE_PHP, cache, entryslotid, (xc_entry_t *) xce TSRMLS_CC);
    309 }
    310 /* }}} */
    311 static xc_entry_var_t *xc_entry_var_store_dmz(xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_var_t *xce TSRMLS_DC) /* {{{ */
    312 {
    313     return (xc_entry_var_t *) xc_entry_store_dmz(XC_TYPE_VAR, cache, entryslotid, (xc_entry_t *) xce TSRMLS_CC);
    314 }
    315 /* }}} */
    316 static void xc_entry_free_real_dmz(xc_entry_type_t type, xc_cache_t *cache, volatile xc_entry_t *xce) /* {{{ */
     306static xc_entry_php_t *xc_entry_php_store_dmz(xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_php_t *entry_php TSRMLS_DC) /* {{{ */
     307{
     308    return (xc_entry_php_t *) xc_entry_store_dmz(XC_TYPE_PHP, cache, entryslotid, (xc_entry_t *) entry_php TSRMLS_CC);
     309}
     310/* }}} */
     311static xc_entry_var_t *xc_entry_var_store_dmz(xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_var_t *entry_var TSRMLS_DC) /* {{{ */
     312{
     313    return (xc_entry_var_t *) xc_entry_store_dmz(XC_TYPE_VAR, cache, entryslotid, (xc_entry_t *) entry_var TSRMLS_CC);
     314}
     315/* }}} */
     316static void xc_entry_free_real_dmz(xc_entry_type_t type, xc_cache_t *cache, volatile xc_entry_t *entry) /* {{{ */
    317317{
    318318    if (type == XC_TYPE_PHP) {
    319         xc_php_release_dmz(cache, ((xc_entry_php_t *) xce)->php);
    320     }
    321     cache->mem->handlers->free(cache->mem, (xc_entry_t *)xce);
    322 }
    323 /* }}} */
    324 static void xc_entry_free_dmz(xc_entry_type_t type, xc_cache_t *cache, xc_entry_t *xce TSRMLS_DC) /* {{{ */
     319        xc_php_release_dmz(cache, ((xc_entry_php_t *) entry)->php);
     320    }
     321    cache->mem->handlers->free(cache->mem, (xc_entry_t *)entry);
     322}
     323/* }}} */
     324static void xc_entry_free_dmz(xc_entry_type_t type, xc_cache_t *cache, xc_entry_t *entry TSRMLS_DC) /* {{{ */
    325325{
    326326    cache->entries_count --;
    327     if ((type == XC_TYPE_PHP ? ((xc_entry_php_t *) xce)->refcount : 0) == 0) {
    328         xc_entry_free_real_dmz(type, cache, xce);
     327    if ((type == XC_TYPE_PHP ? ((xc_entry_php_t *) entry)->refcount : 0) == 0) {
     328        xc_entry_free_real_dmz(type, cache, entry);
    329329    }
    330330    else {
    331         xce->next = cache->deletes;
    332         cache->deletes = xce;
    333         xce->dtime = XG(request_time);
     331        entry->next = cache->deletes;
     332        cache->deletes = entry;
     333        entry->dtime = XG(request_time);
    334334        cache->deletes_count ++;
    335335    }
     
    337337}
    338338/* }}} */
    339 static void xc_entry_remove_dmz(xc_entry_type_t type, xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_t *xce TSRMLS_DC) /* {{{ */
     339static void xc_entry_remove_dmz(xc_entry_type_t type, xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_t *entry TSRMLS_DC) /* {{{ */
    340340{
    341341    xc_entry_t **pp = &(cache->entries[entryslotid]);
    342342    xc_entry_t *p;
    343343    for (p = *pp; p; pp = &(p->next), p = p->next) {
    344         if (xc_entry_equal_dmz(type, xce, p)) {
     344        if (xc_entry_equal_dmz(type, entry, p)) {
    345345            /* unlink */
    346346            *pp = p->next;
    347             xc_entry_free_dmz(type, cache, xce TSRMLS_CC);
     347            xc_entry_free_dmz(type, cache, entry TSRMLS_CC);
    348348            return;
    349349        }
     
    352352}
    353353/* }}} */
    354 static xc_entry_t *xc_entry_find_dmz(xc_entry_type_t type, xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_t *xce TSRMLS_DC) /* {{{ */
     354static xc_entry_t *xc_entry_find_dmz(xc_entry_type_t type, xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_t *entry TSRMLS_DC) /* {{{ */
    355355{
    356356    xc_entry_t *p;
    357357    for (p = cache->entries[entryslotid]; p; p = p->next) {
    358         if (xc_entry_equal_dmz(type, xce, p)) {
     358        if (xc_entry_equal_dmz(type, entry, p)) {
    359359            zend_bool fresh;
    360360            switch (type) {
     
    362362                {
    363363                    xc_entry_php_t *p_php = (xc_entry_php_t *) p;
    364                     xc_entry_php_t *xce_php = (xc_entry_php_t *) xce;
    365                     fresh = p_php->file_mtime == xce_php->file_mtime && p_php->file_size == xce_php->file_size;
     364                    xc_entry_php_t *entry_php = (xc_entry_php_t *) entry;
     365                    fresh = p_php->file_mtime == entry_php->file_mtime && p_php->file_size == entry_php->file_size;
    366366                }
    367367                break;
     
    397397}
    398398/* }}} */
    399 #if 0
    400 static void xc_entry_hold_var_dmz(xc_entry_t *xce TSRMLS_DC) /* {{{ */
    401 {
    402     xce->refcount ++;
    403     xc_stack_push(&XG(var_holds)[xce->cache->cacheid], (void *)xce);
    404 }
    405 /* }}} */
    406 #endif
    407399static inline zend_uint advance_wrapped(zend_uint val, zend_uint count) /* {{{ */
    408400{
     
    765757/* }}} */
    766758
    767 static zend_op_array *xc_entry_install(xc_entry_php_t *xce, zend_file_handle *h TSRMLS_DC) /* {{{ */
     759static zend_op_array *xc_entry_install(xc_entry_php_t *entry_php, zend_file_handle *h TSRMLS_DC) /* {{{ */
    768760{
    769761    zend_uint i;
    770     xc_entry_data_php_t *p = xce->php;
     762    xc_entry_data_php_t *p = entry_php->php;
    771763    zend_op_array *old_active_op_array = CG(active_op_array);
    772764#ifndef ZEND_ENGINE_2
     
    782774    for (i = 0; i < p->constinfo_cnt; i ++) {
    783775        xc_constinfo_t *ci = &p->constinfos[i];
    784         xc_install_constant(xce->entry.name.str.val, &ci->constant,
     776        xc_install_constant(entry_php->entry.name.str.val, &ci->constant,
    785777                UNISW(0, ci->type), ci->key, ci->key_size, ci->h TSRMLS_CC);
    786778    }
     
    790782    for (i = 0; i < p->funcinfo_cnt; i ++) {
    791783        xc_funcinfo_t  *fi = &p->funcinfos[i];
    792         xc_install_function(xce->entry.name.str.val, &fi->func,
     784        xc_install_function(entry_php->entry.name.str.val, &fi->func,
    793785                UNISW(0, fi->type), fi->key, fi->key_size, fi->h TSRMLS_CC);
    794786    }
     
    808800#endif
    809801#ifdef ZEND_COMPILE_DELAYED_BINDING
    810         xc_install_class(xce->entry.name.str.val, &ci->cest, -1,
     802        xc_install_class(entry_php->entry.name.str.val, &ci->cest, -1,
    811803                UNISW(0, ci->type), ci->key, ci->key_size, ci->h TSRMLS_CC);
    812804#else
    813         xc_install_class(xce->entry.name.str.val, &ci->cest, ci->oplineno,
     805        xc_install_class(entry_php->entry.name.str.val, &ci->cest, ci->oplineno,
    814806                UNISW(0, ci->type), ci->key, ci->key_size, ci->h TSRMLS_CC);
    815807#endif
     
    834826
    835827    i = 1;
    836     zend_hash_add(&EG(included_files), xce->entry.name.str.val, xce->entry.name.str.len+1, (void *)&i, sizeof(int), NULL);
     828    zend_hash_add(&EG(included_files), entry_php->entry.name.str.val, entry_php->entry.name.str.len+1, (void *)&i, sizeof(int), NULL);
    837829    if (h) {
    838830        zend_llist_add_element(&CG(open_files), h);
     
    852844    xc_stack_t *s;
    853845    xc_cache_t *cache;
    854     xc_entry_php_t *xce;
     846    xc_entry_php_t *entry_php;
    855847
    856848    for (i = 0; i < cachecount; i ++) {
     
    861853            ENTER_LOCK(cache) {
    862854                while (xc_stack_count(s)) {
    863                     xce = (xc_entry_php_t *) xc_stack_pop(s);
    864                     TRACE("unhold %d:%s", xce->file_inode, xce->entry.name.str.val);
    865                     xce->refcount ++;
    866                     assert(xce->refcount >= 0);
     855                    entry_php = (xc_entry_php_t *) xc_stack_pop(s);
     856                    TRACE("unhold %d:%s", entry_php->file_inode, entry_php->entry.name.str.val);
     857                    entry_php->refcount ++;
     858                    assert(entry_php->refcount >= 0);
    867859                }
    868860            } LEAVE_LOCK(cache);
     
    948940}
    949941/* }}} */
    950 static inline xc_hash_value_t xc_entry_hash_name(xc_entry_t *xce TSRMLS_DC) /* {{{ */
    951 {
    952     return UNISW(NOTHING, UG(unicode) ? HASH_ZSTR_L(xce->name_type, xce->name.uni.val, xce->name.uni.len) :)
    953         HASH_STR_L(xce->name.str.val, xce->name.str.len);
    954 }
    955 /* }}} */
    956 static inline xc_hash_value_t xc_entry_hash_php_basename(xc_entry_php_t *xce TSRMLS_DC) /* {{{ */
     942static inline xc_hash_value_t xc_entry_hash_name(xc_entry_t *entry TSRMLS_DC) /* {{{ */
     943{
     944    return UNISW(NOTHING, UG(unicode) ? HASH_ZSTR_L(entry->name_type, entry->name.uni.val, entry->name.uni.len) :)
     945        HASH_STR_L(entry->name.str.val, entry->name.str.len);
     946}
     947/* }}} */
     948static inline xc_hash_value_t xc_entry_hash_php_basename(xc_entry_php_t *entry_php TSRMLS_DC) /* {{{ */
    957949{
    958950#ifdef IS_UNICODE
    959     if (UG(unicode) && xce->entry.name_type == IS_UNICODE) {
     951    if (UG(unicode) && entry_php->entry.name_type == IS_UNICODE) {
    960952        zstr basename;
    961953        size_t basename_len;
    962         php_u_basename(xce->entry.name.ustr.val, xce->entry.name.ustr.len, NULL, 0, &basename.u, &basename_len TSRMLS_CC);
     954        php_u_basename(entry_php->entry.name.ustr.val, entry_php->entry.name.ustr.len, NULL, 0, &basename.u, &basename_len TSRMLS_CC);
    963955        return HASH_ZSTR_L(IS_UNICODE, basename, basename_len);
    964956    }
     
    970962        size_t basename_len;
    971963#ifdef ZEND_ENGINE_2
    972         php_basename(xce->entry.name.str.val, xce->entry.name.str.len, "", 0, &basename, &basename_len TSRMLS_CC);
     964        php_basename(entry_php->entry.name.str.val, entry_php->entry.name.str.len, "", 0, &basename, &basename_len TSRMLS_CC);
    973965#else
    974         basename = php_basename(xce->entry.name.str.val, xce->entry.name.str.len, "", 0);
     966        basename = php_basename(entry_php->entry.name.str.val, entry_php->entry.name.str.len, "", 0);
    975967        basename_len = strlen(basename);
    976968#endif
     
    982974/* }}} */
    983975#define xc_entry_hash_var xc_entry_hash_name
    984 static void xc_entry_free_key_php(xc_entry_php_t *xce TSRMLS_DC) /* {{{ */
     976static void xc_entry_free_key_php(xc_entry_php_t *entry_php TSRMLS_DC) /* {{{ */
    985977{
    986978#define X_FREE(var) do {\
    987     if (xce->var) { \
    988         efree(xce->var); \
     979    if (entry_php->var) { \
     980        efree(entry_php->var); \
    989981    } \
    990982} while (0)
     
    13221314}
    13231315/* }}} */
    1324 void xc_fix_op_array_info(const xc_entry_php_t *xce, 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) /* {{{ */
     1316void 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) /* {{{ */
    13251317{
    13261318    int i;
     
    13361328            }
    13371329            if (Z_TYPE(literal->constant) == IS_STRING) {
    1338                 assert(xce->filepath);
    1339                 ZVAL_STRINGL(&literal->constant, xce->filepath, xce->filepath_len, !shallow_copy);
    1340                 TRACE("restored literal constant: %s", xce->filepath);
     1330                assert(entry_php->filepath);
     1331                ZVAL_STRINGL(&literal->constant, entry_php->filepath, entry_php->filepath_len, !shallow_copy);
     1332                TRACE("restored literal constant: %s", entry_php->filepath);
    13411333            }
    13421334#ifdef IS_UNICODE
    13431335            else if (Z_TYPE(literal->constant) == IS_UNICODE) {
    1344                 assert(xce->ufilepath);
    1345                 ZVAL_UNICODEL(&literal->constant, xce->ufilepath, xce->ufilepath_len, !shallow_copy);
     1336                assert(entry_php->ufilepath);
     1337                ZVAL_UNICODEL(&literal->constant, entry_php->ufilepath, entry_php->ufilepath_len, !shallow_copy);
    13461338            }
    13471339#endif
     
    13551347            }
    13561348            if (Z_TYPE(literal->constant) == IS_STRING) {
    1357                 assert(xce->dirpath);
    1358                 TRACE("restored literal constant: %s", xce->dirpath);
    1359                 ZVAL_STRINGL(&literal->constant, xce->dirpath, xce->dirpath_len, !shallow_copy);
     1349                assert(entry_php->dirpath);
     1350                TRACE("restored literal constant: %s", entry_php->dirpath);
     1351                ZVAL_STRINGL(&literal->constant, entry_php->dirpath, entry_php->dirpath_len, !shallow_copy);
    13601352            }
    13611353#ifdef IS_UNICODE
    13621354            else if (Z_TYPE(literal->constant) == IS_UNICODE) {
    1363                 assert(!xce->udirpath);
    1364                 ZVAL_UNICODEL(&literal->constant, xce->udirpath, xce->udirpath_len, !shallow_copy);
     1355                assert(!entry_php->udirpath);
     1356                ZVAL_UNICODEL(&literal->constant, entry_php->udirpath, entry_php->udirpath_len, !shallow_copy);
    13651357            }
    13661358#endif
     
    13811373            }
    13821374            if (Z_TYPE(Z_OP_CONSTANT(opline->op1)) == IS_STRING) {
    1383                 assert(xce->filepath);
    1384                 ZVAL_STRINGL(&Z_OP_CONSTANT(opline->op1), xce->filepath, xce->filepath_len, !shallow_copy);
    1385                 TRACE("restored op1 constant: %s", xce->filepath);
     1375                assert(entry_php->filepath);
     1376                ZVAL_STRINGL(&Z_OP_CONSTANT(opline->op1), entry_php->filepath, entry_php->filepath_len, !shallow_copy);
     1377                TRACE("restored op1 constant: %s", entry_php->filepath);
    13861378            }
    13871379#ifdef IS_UNICODE
    13881380            else if (Z_TYPE(Z_OP_CONSTANT(opline->op1)) == IS_UNICODE) {
    1389                 assert(xce->ufilepath);
    1390                 ZVAL_UNICODEL(&Z_OP_CONSTANT(opline->op1), xce->ufilepath, xce->ufilepath_len, !shallow_copy);
     1381                assert(entry_php->ufilepath);
     1382                ZVAL_UNICODEL(&Z_OP_CONSTANT(opline->op1), entry_php->ufilepath, entry_php->ufilepath_len, !shallow_copy);
    13911383            }
    13921384#endif
     
    14011393            }
    14021394            if (Z_TYPE(Z_OP_CONSTANT(opline->op1)) == IS_STRING) {
    1403                 assert(xce->dirpath);
    1404                 TRACE("restored op1 constant: %s", xce->dirpath);
    1405                 ZVAL_STRINGL(&Z_OP_CONSTANT(opline->op1), xce->dirpath, xce->dirpath_len, !shallow_copy);
     1395                assert(entry_php->dirpath);
     1396                TRACE("restored op1 constant: %s", entry_php->dirpath);
     1397                ZVAL_STRINGL(&Z_OP_CONSTANT(opline->op1), entry_php->dirpath, entry_php->dirpath_len, !shallow_copy);
    14061398            }
    14071399#ifdef IS_UNICODE
    14081400            else if (Z_TYPE(Z_OP_CONSTANT(opline->op1)) == IS_UNICODE) {
    1409                 assert(!xce->udirpath);
    1410                 ZVAL_UNICODEL(&Z_OP_CONSTANT(opline->op1), xce->udirpath, xce->udirpath_len, !shallow_copy);
     1401                assert(!entry_php->udirpath);
     1402                ZVAL_UNICODEL(&Z_OP_CONSTANT(opline->op1), entry_php->udirpath, entry_php->udirpath_len, !shallow_copy);
    14111403            }
    14121404#endif
     
    14221414            }
    14231415            if (Z_TYPE(Z_OP_CONSTANT(opline->op2)) == IS_STRING) {
    1424                 assert(xce->filepath);
    1425                 TRACE("restored op2 constant: %s", xce->filepath);
    1426                 ZVAL_STRINGL(&Z_OP_CONSTANT(opline->op2), xce->filepath, xce->filepath_len, !shallow_copy);
     1416                assert(entry_php->filepath);
     1417                TRACE("restored op2 constant: %s", entry_php->filepath);
     1418                ZVAL_STRINGL(&Z_OP_CONSTANT(opline->op2), entry_php->filepath, entry_php->filepath_len, !shallow_copy);
    14271419            }
    14281420#ifdef IS_UNICODE
    14291421            else if (Z_TYPE(Z_OP_CONSTANT(opline->op2)) == IS_UNICODE) {
    1430                 assert(xce->ufilepath);
    1431                 ZVAL_UNICODEL(&Z_OP_CONSTANT(opline->op2), xce->ufilepath, xce->ufilepath_len, !shallow_copy);
     1422                assert(entry_php->ufilepath);
     1423                ZVAL_UNICODEL(&Z_OP_CONSTANT(opline->op2), entry_php->ufilepath, entry_php->ufilepath_len, !shallow_copy);
    14321424            }
    14331425#endif
     
    14421434            }
    14431435            if (Z_TYPE(Z_OP_CONSTANT(opline->op2)) == IS_STRING) {
    1444                 assert(!xce->dirpath);
    1445                 TRACE("restored op2 constant: %s", xce->dirpath);
    1446                 ZVAL_STRINGL(&Z_OP_CONSTANT(opline->op2), xce->dirpath, xce->dirpath_len, !shallow_copy);
     1436                assert(!entry_php->dirpath);
     1437                TRACE("restored op2 constant: %s", entry_php->dirpath);
     1438                ZVAL_STRINGL(&Z_OP_CONSTANT(opline->op2), entry_php->dirpath, entry_php->dirpath_len, !shallow_copy);
    14471439            }
    14481440#ifdef IS_UNICODE
    14491441            else if (Z_TYPE(Z_OP_CONSTANT(opline->op2)) == IS_UNICODE) {
    1450                 assert(!xce->udirpath);
    1451                 ZVAL_UNICODEL(&Z_OP_CONSTANT(opline->op2), xce->udirpath, xce->udirpath_len, !shallow_copy);
     1442                assert(!entry_php->udirpath);
     1443                ZVAL_UNICODEL(&Z_OP_CONSTANT(opline->op2), entry_php->udirpath, entry_php->udirpath_len, !shallow_copy);
    14521444            }
    14531445#endif
     
    26602652} while (0)
    26612653
    2662 static int xc_entry_init_key_var(xc_entry_hash_t *entry_hash, xc_entry_var_t *xce, zval *name TSRMLS_DC) /* {{{ */
     2654static int xc_entry_var_init_key(xc_entry_var_t *entry_var, xc_entry_hash_t *entry_hash, zval *name TSRMLS_DC) /* {{{ */
    26632655{
    26642656    xc_hash_value_t hv;
     
    26782670
    26792671#ifdef IS_UNICODE
    2680     xce->entry.name_type = name->type;
    2681 #endif
    2682     xce->entry.name = name->value;
    2683 
    2684     hv = xc_entry_hash_var((xc_entry_t *) xce TSRMLS_CC);
     2672    entry_var->entry.name_type = name->type;
     2673#endif
     2674    entry_var->entry.name = name->value;
     2675
     2676    hv = xc_entry_hash_var((xc_entry_t *) entry_var TSRMLS_CC);
    26852677
    26862678    entry_hash->cacheid = (hv & xc_var_hcache.mask);
     
    26962688    xc_entry_hash_t entry_hash;
    26972689    xc_cache_t *cache;
    2698     xc_entry_var_t xce, *stored_xce;
     2690    xc_entry_var_t entry_var, *stored_entry_var;
    26992691    zval *name;
    27002692
     
    27072699        return;
    27082700    }
    2709     xc_entry_init_key_var(&entry_hash, &xce, name TSRMLS_CC);
     2701    xc_entry_var_init_key(&entry_var, &entry_hash, name TSRMLS_CC);
    27102702    cache = xc_var_caches[entry_hash.cacheid];
    27112703
    27122704    ENTER_LOCK(cache) {
    2713         stored_xce = (xc_entry_var_t *) xc_entry_find_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &xce TSRMLS_CC);
    2714         if (stored_xce) {
     2705        stored_entry_var = (xc_entry_var_t *) xc_entry_find_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &entry_var TSRMLS_CC);
     2706        if (stored_entry_var) {
    27152707            /* return */
    2716             xc_processor_restore_zval(return_value, stored_xce->value, stored_xce->have_references TSRMLS_CC);
     2708            xc_processor_restore_zval(return_value, stored_entry_var->value, stored_entry_var->have_references TSRMLS_CC);
    27172709            xc_cache_hit_dmz(cache TSRMLS_CC);
    27182710        }
     
    27302722    xc_entry_hash_t entry_hash;
    27312723    xc_cache_t *cache;
    2732     xc_entry_var_t xce, *stored_xce;
     2724    xc_entry_var_t entry_var, *stored_entry_var;
    27332725    zval *name;
    27342726    zval *value;
     
    27392731    }
    27402732
    2741     xce.entry.ttl = XG(var_ttl);
    2742     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|l", &name, &value, &xce.entry.ttl) == FAILURE) {
     2733    entry_var.entry.ttl = XG(var_ttl);
     2734    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|l", &name, &value, &entry_var.entry.ttl) == FAILURE) {
    27432735        return;
    27442736    }
    27452737
    27462738    /* max ttl */
    2747     if (xc_var_maxttl && (!xce.entry.ttl || xce.entry.ttl > xc_var_maxttl)) {
    2748         xce.entry.ttl = xc_var_maxttl;
    2749     }
    2750 
    2751     xc_entry_init_key_var(&entry_hash, &xce, name TSRMLS_CC);
     2739    if (xc_var_maxttl && (!entry_var.entry.ttl || entry_var.entry.ttl > xc_var_maxttl)) {
     2740        entry_var.entry.ttl = xc_var_maxttl;
     2741    }
     2742
     2743    xc_entry_var_init_key(&entry_var, &entry_hash, name TSRMLS_CC);
    27522744    cache = xc_var_caches[entry_hash.cacheid];
    27532745
    27542746    ENTER_LOCK(cache) {
    2755         stored_xce = (xc_entry_var_t *) xc_entry_find_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &xce TSRMLS_CC);
    2756         if (stored_xce) {
    2757             xc_entry_remove_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) stored_xce TSRMLS_CC);
    2758         }
    2759         xce.value = value;
    2760         RETVAL_BOOL(xc_entry_var_store_dmz(cache, entry_hash.entryslotid, &xce TSRMLS_CC) != NULL ? 1 : 0);
     2747        stored_entry_var = (xc_entry_var_t *) xc_entry_find_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &entry_var TSRMLS_CC);
     2748        if (stored_entry_var) {
     2749            xc_entry_remove_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) stored_entry_var TSRMLS_CC);
     2750        }
     2751        entry_var.value = value;
     2752        RETVAL_BOOL(xc_entry_var_store_dmz(cache, entry_hash.entryslotid, &entry_var TSRMLS_CC) != NULL ? 1 : 0);
    27612753    } LEAVE_LOCK(cache);
    27622754}
     
    27682760    xc_entry_hash_t entry_hash;
    27692761    xc_cache_t *cache;
    2770     xc_entry_var_t xce, *stored_xce;
     2762    xc_entry_var_t entry_var, *stored_entry_var;
    27712763    zval *name;
    27722764
     
    27792771        return;
    27802772    }
    2781     xc_entry_init_key_var(&entry_hash, &xce, name TSRMLS_CC);
     2773    xc_entry_var_init_key(&entry_var, &entry_hash, name TSRMLS_CC);
    27822774    cache = xc_var_caches[entry_hash.cacheid];
    27832775
    27842776    ENTER_LOCK(cache) {
    2785         stored_xce = (xc_entry_var_t *) xc_entry_find_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &xce TSRMLS_CC);
    2786         if (stored_xce) {
     2777        stored_entry_var = (xc_entry_var_t *) xc_entry_find_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &entry_var TSRMLS_CC);
     2778        if (stored_entry_var) {
    27872779            xc_cache_hit_dmz(cache TSRMLS_CC);
    27882780            RETVAL_TRUE;
     
    28022794    xc_entry_hash_t entry_hash;
    28032795    xc_cache_t *cache;
    2804     xc_entry_var_t xce, *stored_xce;
     2796    xc_entry_var_t entry_var, *stored_entry_var;
    28052797    zval *name;
    28062798
     
    28132805        return;
    28142806    }
    2815     xc_entry_init_key_var(&entry_hash, &xce, name TSRMLS_CC);
     2807    xc_entry_var_init_key(&entry_var, &entry_hash, name TSRMLS_CC);
    28162808    cache = xc_var_caches[entry_hash.cacheid];
    28172809
    28182810    ENTER_LOCK(cache) {
    2819         stored_xce = (xc_entry_var_t *) xc_entry_find_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &xce TSRMLS_CC);
    2820         if (stored_xce) {
    2821             xc_entry_remove_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) stored_xce TSRMLS_CC);
     2811        stored_entry_var = (xc_entry_var_t *) xc_entry_find_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &entry_var TSRMLS_CC);
     2812        if (stored_entry_var) {
     2813            xc_entry_remove_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) stored_entry_var TSRMLS_CC);
    28222814            RETVAL_TRUE;
    28232815        }
     
    28652857    xc_entry_hash_t entry_hash;
    28662858    xc_cache_t *cache;
    2867     xc_entry_var_t xce, *stored_xce;
     2859    xc_entry_var_t entry_var, *stored_entry_var;
    28682860    zval *name;
    28692861    long count = 1;
     
    28762868    }
    28772869
    2878     xce.entry.ttl = XG(var_ttl);
    2879     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ll", &name, &count, &xce.entry.ttl) == FAILURE) {
     2870    entry_var.entry.ttl = XG(var_ttl);
     2871    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ll", &name, &count, &entry_var.entry.ttl) == FAILURE) {
    28802872        return;
    28812873    }
    28822874
    28832875    /* max ttl */
    2884     if (xc_var_maxttl && (!xce.entry.ttl || xce.entry.ttl > xc_var_maxttl)) {
    2885         xce.entry.ttl = xc_var_maxttl;
    2886     }
    2887 
    2888     xc_entry_init_key_var(&entry_hash, &xce, name TSRMLS_CC);
     2876    if (xc_var_maxttl && (!entry_var.entry.ttl || entry_var.entry.ttl > xc_var_maxttl)) {
     2877        entry_var.entry.ttl = xc_var_maxttl;
     2878    }
     2879
     2880    xc_entry_var_init_key(&entry_var, &entry_hash, name TSRMLS_CC);
    28892881    cache = xc_var_caches[entry_hash.cacheid];
    28902882
    28912883    ENTER_LOCK(cache) {
    2892         stored_xce = (xc_entry_var_t *) xc_entry_find_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &xce TSRMLS_CC);
    2893         if (stored_xce) {
    2894             TRACE("incdec: gotxce %s", xce.entry.name.str.val);
     2884        stored_entry_var = (xc_entry_var_t *) xc_entry_find_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &entry_var TSRMLS_CC);
     2885        if (stored_entry_var) {
     2886            TRACE("incdec: got entry_var %s", entry_var.entry.name.str.val);
    28952887            /* do it in place */
    2896             if (Z_TYPE_P(stored_xce->value) == IS_LONG) {
     2888            if (Z_TYPE_P(stored_entry_var->value) == IS_LONG) {
    28972889                zval *zv;
    2898                 stored_xce->entry.ctime = XG(request_time);
    2899                 stored_xce->entry.ttl   = xce.entry.ttl;
     2890                stored_entry_var->entry.ctime = XG(request_time);
     2891                stored_entry_var->entry.ttl   = entry_var.entry.ttl;
    29002892                TRACE("%s", "incdec: islong");
    2901                 value = Z_LVAL_P(stored_xce->value);
     2893                value = Z_LVAL_P(stored_entry_var->value);
    29022894                value += (inc == 1 ? count : - count);
    29032895                RETVAL_LONG(value);
    29042896
    2905                 zv = (zval *) cache->shm->handlers->to_readwrite(cache->shm, (char *) stored_xce->value);
     2897                zv = (zval *) cache->shm->handlers->to_readwrite(cache->shm, (char *) stored_entry_var->value);
    29062898                Z_LVAL_P(zv) = value;
    29072899                break; /* leave lock */
     
    29092901
    29102902            TRACE("%s", "incdec: notlong");
    2911             xc_processor_restore_zval(&oldzval, stored_xce->value, stored_xce->have_references TSRMLS_CC);
     2903            xc_processor_restore_zval(&oldzval, stored_entry_var->value, stored_entry_var->have_references TSRMLS_CC);
    29122904            convert_to_long(&oldzval);
    29132905            value = Z_LVAL(oldzval);
     
    29152907        }
    29162908        else {
    2917             TRACE("incdec: %s not found", xce.entry.name.str.val);
     2909            TRACE("incdec: %s not found", entry_var.entry.name.str.val);
    29182910        }
    29192911
    29202912        value += (inc == 1 ? count : - count);
    29212913        RETVAL_LONG(value);
    2922         xce.value = return_value;
    2923 
    2924         if (stored_xce) {
    2925             xce.entry.atime = stored_xce->entry.atime;
    2926             xce.entry.ctime = stored_xce->entry.ctime;
    2927             xce.entry.hits  = stored_xce->entry.hits;
    2928             xc_entry_remove_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) stored_xce TSRMLS_CC);
    2929         }
    2930         xc_entry_var_store_dmz(cache, entry_hash.entryslotid, &xce TSRMLS_CC);
    2931 
     2914        entry_var.value = return_value;
     2915
     2916        if (stored_entry_var) {
     2917            entry_var.entry.atime = stored_entry_var->entry.atime;
     2918            entry_var.entry.ctime = stored_entry_var->entry.ctime;
     2919            entry_var.entry.hits  = stored_entry_var->entry.hits;
     2920            xc_entry_remove_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) stored_entry_var TSRMLS_CC);
     2921        }
     2922        xc_entry_var_store_dmz(cache, entry_hash.entryslotid, &entry_var TSRMLS_CC);
    29322923    } LEAVE_LOCK(cache);
    29332924}
Note: See TracChangeset for help on using the changeset viewer.