Changeset 681


Ignore:
Timestamp:
2009-09-08T05:17:51+02:00 (5 years ago)
Author:
moo
Message:

PHP_6: new zend_constants.dtor which is used to free zend_constant.value on shutdown. cannot be used for XCache temp zend_constants table

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/utils.c

    r679 r681  
    641641{ 
    642642    assert((c->flags & CONST_PERSISTENT)); 
    643 #ifdef IS_UNICODE 
    644     c->name.u = zend_ustrndup(c->name.u, c->name_len - 1); 
    645 #else 
    646     c->name = zend_strndup(c->name, c->name_len - 1); 
    647 #endif 
     643    ZSTR_U(c->name) = UNISW(zend_strndup, zend_ustrndup)(ZSTR_U(c->name), c->name_len - 1); 
    648644} 
    649645/* }}} */ 
    650646void xc_zend_constant_dtor(zend_constant *c) /* {{{ */ 
    651647{ 
    652     free(ZSTR_U(c->name)); 
     648    free(ZSTR_V(c->name)); 
     649} 
     650/* }}} */ 
     651void xc_free_zend_constant(zend_constant *c) /* {{{ */ 
     652{ 
     653    if (!(c->flags & CONST_PERSISTENT)) { 
     654        zval_dtor(&c->value); 
     655    } 
     656    free(ZSTR_V(c->name)); 
    653657} 
    654658/* }}} */ 
     
    696700#ifdef HAVE_XCACHE_CONSTANT 
    697701    h = OG(zend_constants); 
    698     zend_hash_init_ex(&TG(zend_constants),  20, NULL, h->pDestructor, h->persistent, h->bApplyProtection); 
     702    zend_hash_init_ex(&TG(zend_constants),  20, NULL, (dtor_func_t) xc_free_zend_constant, h->persistent, h->bApplyProtection); 
    699703    xc_copy_internal_zend_constants(&TG(zend_constants), &XG(internal_constant_table)); 
    700704    { 
Note: See TracChangeset for help on using the changeset viewer.