Changeset 1030 in svn for trunk/xcache.c


Ignore:
Timestamp:
2012-07-22T07:55:34Z (3 years ago)
Author:
Xuefer
Message:

refactor: cleanup initial_compile_file_called

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/xcache.c

    r1029 r1030  
    16381638
    16391639    if (!XG(initial_compile_file_called)) {
     1640        TRACE("%s", "!initial_compile_file_called, give up");
    16401641        return;
    16411642    }
     
    24392440
    24402441        if (xc_php_size) {
    2441             old_compile_file = zend_compile_file;
    2442             zend_compile_file = xc_compile_file;
    2443 
    24442442            CHECK(xc_php_caches = xc_cache_init(xc_shm, &xc_php_hcache, &xc_php_hentry, &xc_php_hentry, xc_php_size), "failed init opcode cache");
    24452443        }
     
    35253523#endif
    35263524
     3525static void xc_zend_startup_last() /* {{{ */
     3526{
     3527    if (xc_php_size) {
     3528        old_compile_file = zend_compile_file;
     3529        zend_compile_file = xc_compile_file;
     3530    }
     3531}
     3532/* }}} */
    35273533static startup_func_t xc_last_ext_startup;
    3528 static int xc_zend_startup_last(zend_extension *extension) /* {{{ */
     3534static int xc_zend_startup_last_hook(zend_extension *extension) /* {{{ */
    35293535{
    35303536    zend_extension *ext = zend_get_extension(XCACHE_NAME);
     
    35413547    assert(xc_llist_zend_extension);
    35423548    xcache_llist_prepend(&zend_extensions, xc_llist_zend_extension);
     3549
     3550    xc_zend_startup_last();
    35433551    return SUCCESS;
    35443552}
     
    35463554static int xc_zend_startup(zend_extension *extension) /* {{{ */
    35473555{
    3548     if (!origin_compile_file) {
    3549         origin_compile_file = zend_compile_file;
    3550         zend_compile_file = xc_check_initial_compile_file;
    3551     }
     3556    origin_compile_file = zend_compile_file;
     3557    zend_compile_file = xc_check_initial_compile_file;
    35523558
    35533559    if (zend_llist_count(&zend_extensions) > 1) {
     
    35593565            zend_error(E_WARNING, "XCache failed to load itself as the first zend_extension. compatibility downgraded");
    35603566        }
     3567
    35613568        /* hide myself */
     3569        /* TODO: hide handle sub modules */
    35623570        xcache_llist_unlink(&zend_extensions, xc_llist_zend_extension);
    35633571
     
    35653573        assert(ext && ext != (zend_extension *) xc_llist_zend_extension->data);
    35663574        xc_last_ext_startup = ext->startup;
    3567         ext->startup = xc_zend_startup_last;
     3575        ext->startup = xc_zend_startup_last_hook;
     3576    }
     3577    else {
     3578        xc_zend_startup_last();
    35683579    }
    35693580    return SUCCESS;
Note: See TracChangeset for help on using the changeset viewer.