Changeset 17 in svn for trunk/xcache.c


Ignore:
Timestamp:
2006-05-25T02:31:16Z (9 years ago)
Author:
Xuefer
Message:

void circle dependcy between ZEND_INIT_MODULE_GLOBALS and REGISTER_INI_ENTRIES

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/xcache.c

    r11 r17  
    990990static void xc_request_init(TSRMLS_D) /* {{{ */
    991991{
     992    int i;
     993
     994    if (xc_php_hcache.size && !XG(php_holds)) {
     995        XG(php_holds) = calloc(xc_php_hcache.size, sizeof(xc_stack_t));
     996        for (i = 0; i < xc_php_hcache.size; i ++) {
     997            xc_stack_init(&XG(php_holds[i]));
     998        }
     999    }
     1000
     1001    if (xc_var_hcache.size && !XG(var_holds)) {
     1002        XG(var_holds) = calloc(xc_var_hcache.size, sizeof(xc_stack_t));
     1003        for (i = 0; i < xc_var_hcache.size; i ++) {
     1004            xc_stack_init(&XG(var_holds[i]));
     1005        }
     1006    }
     1007
    9921008    if (XG(cacher)) {
    9931009#if PHP_API_VERSION <= 20041225
     
    10121028static void xc_init_globals(zend_xcache_globals* xc_globals TSRMLS_DC) /* {{{ */
    10131029{
    1014     int i;
    1015 
    1016     if (xc_php_hcache.size) {
    1017         xc_globals->php_holds = calloc(xc_php_hcache.size, sizeof(xc_stack_t));
    1018         for (i = 0; i < xc_php_hcache.size; i ++) {
    1019             xc_stack_init(&xc_globals->php_holds[i]);
    1020         }
    1021     }
    1022     else {
    1023         xc_globals->php_holds = NULL;
    1024     }
    1025 
    1026     if (xc_var_hcache.size) {
    1027         xc_globals->var_holds = calloc(xc_var_hcache.size, sizeof(xc_stack_t));
    1028         for (i = 0; i < xc_var_hcache.size; i ++) {
    1029             xc_stack_init(&xc_globals->var_holds[i]);
    1030         }
    1031     }
    1032     else {
    1033         xc_globals->var_holds = NULL;
    1034     }
    1035 
    1036 #ifdef HAVE_XCACHE_COVERAGE
    1037     xc_globals->coverages = NULL;
    1038 #endif
     1030    memset(xc_globals, 0, sizeof(zend_xcache_globals));
    10391031}
    10401032/* }}} */
     
    15401532        return;
    15411533    }
    1542     if (spec <= xc_get_opcode_spec_count()) {
     1534    if ((zend_uchar) spec <= xc_get_opcode_spec_count()) {
    15431535        opspec = xc_get_opcode_spec((zend_uchar) spec);
    15441536        if (opspec) {
     
    17921784    char *env;
    17931785
    1794     REGISTER_INI_ENTRIES();
    1795 
    17961786    xc_module_gotup = 1;
    17971787    if (!xc_zend_extension_gotup) {
     
    18021792    }
    18031793
     1794    ZEND_INIT_MODULE_GLOBALS(xcache, xc_init_globals, xc_shutdown_globals);
     1795    REGISTER_INI_ENTRIES();
     1796
    18041797    if (strcmp(sapi_module.name, "cli") == 0) {
    18051798        if ((env = getenv("XCACHE_TEST")) != NULL) {
     
    18181811        xc_var_size = xc_var_hcache.size = 0;
    18191812    }
    1820     /* xc_init_globals depends on all the aboves */
    1821 
    1822     ZEND_INIT_MODULE_GLOBALS(xcache, xc_init_globals, xc_shutdown_globals);
    18231813
    18241814    original_sigsegv_handler = signal(SIGSEGV, xcache_sigsegv_handler);
Note: See TracChangeset for help on using the changeset viewer.