Changeset 378 for branches/1.2/utils.c


Ignore:
Timestamp:
2007-05-07T19:21:35+02:00 (7 years ago)
Author:
moo
Message:

merged[344] [345] [346] from trunk->1.2: fixed #59: pass by reference for internal function was broken

Location:
branches/1.2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2

  • branches/1.2/utils.c

    r295 r378  
    11 
    22#include "xcache.h" 
     3#include "stack.h" 
     4#include "xcache_globals.h" 
    35#include "utils.h" 
    46#ifdef ZEND_ENGINE_2_1 
     
    534536/* }}} */ 
    535537#endif 
     538 
     539void xc_zend_class_add_ref(zend_class_entry ZESW(*ce, **ce)) 
     540{ 
     541#ifdef ZEND_ENGINE_2 
     542    (*ce)->refcount++; 
     543#else 
     544    (*ce->refcount)++; 
     545#endif 
     546} 
     547 
    536548xc_sandbox_t *xc_sandbox_init(xc_sandbox_t *sandbox, char *filename TSRMLS_DC) /* {{{ */ 
    537549{ 
    538550    HashTable *h; 
     551 
    539552    if (sandbox) { 
    540553        memset(sandbox, 0, sizeof(sandbox[0])); 
     
    573586    h = OG(function_table); 
    574587    zend_hash_init_ex(&TG(function_table), 128, NULL, h->pDestructor, h->persistent, h->bApplyProtection); 
     588    { 
     589        zend_function tmp_func; 
     590        zend_hash_copy(&TG(function_table), &XG(internal_function_table), (copy_ctor_func_t) function_add_ref, (void *) &tmp_func, sizeof(tmp_func)); 
     591    } 
     592    TG(internal_class_tail) = TG(function_table).pListTail; 
     593 
    575594    h = OG(class_table); 
    576595    zend_hash_init_ex(&TG(class_table),     16, NULL, h->pDestructor, h->persistent, h->bApplyProtection); 
     596#if 0 && TODO 
     597    { 
     598        xc_cest_t tmp_cest; 
     599        zend_hash_copy(&TG(class_table), &XG(internal_class_table), (copy_ctor_func_t) xc_zend_class_add_ref, (void *) &tmp_cest, sizeof(tmp_cest)); 
     600    } 
     601#endif 
     602    TG(internal_class_tail) = TG(class_table).pListTail; 
     603 
    577604#ifdef ZEND_ENGINE_2_1 
    578605    /* shallow copy, don't destruct */ 
     
    619646#endif 
    620647 
    621     b = TG(function_table).pListHead; 
     648    b = TG(internal_function_tail) ? TG(internal_function_tail)->pListNext : TG(function_table).pListHead; 
    622649    /* install function */ 
    623650    while (b != NULL) { 
     
    628655    } 
    629656 
    630     b = TG(class_table).pListHead; 
     657    b = TG(internal_class_tail) ? TG(internal_class_tail)->pListNext : TG(class_table).pListHead; 
    631658    /* install class */ 
    632659    while (b != NULL) { 
Note: See TracChangeset for help on using the changeset viewer.