Changeset 1470 in svn for trunk/mod_cacher/xc_cacher.c


Ignore:
Timestamp:
2013-11-12T11:08:17+01:00 (21 months ago)
Author:
Xuefer
Message:

processor: abstract store target (storage)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mod_cacher/xc_cacher.c

    r1468 r1470  
    160160static void xc_holds_destroy(TSRMLS_D);
    161161
     162static void *xc_cache_storage(void *data, size_t size) /* {{{ */
     163{
     164    xc_allocator_t *allocator = (xc_allocator_t *) data;
     165    return allocator->vtable->malloc(allocator, size);
     166}
     167/* }}} */
     168
    162169/* any function in *_unlocked is only safe be called within locked (single thread access) area */
    163170
     
    173180{
    174181    xc_entry_data_php_t *stored_php;
     182    xc_processor_storage_t storage;
     183    storage.allocator      = &xc_cache_storage;
     184    storage.allocator_data = (void *) cache->allocator;
     185    storage.relocatediff   = cache->shm->readonlydiff;
    175186
    176187    php->hits     = 0;
    177188    php->refcount = 0;
    178     stored_php = xc_processor_store_xc_entry_data_php_t(cache->shm->readonlydiff, cache->allocator, php TSRMLS_CC);
     189    stored_php = xc_processor_store_xc_entry_data_php_t(&storage, php TSRMLS_CC);
    179190#if 0
    180191    {
     
    308319{
    309320    xc_entry_t *stored_entry;
     321    xc_processor_storage_t storage;
     322    storage.allocator      = &xc_cache_storage;
     323    storage.allocator_data = (void *) cache->allocator;
     324    storage.relocatediff   = cache->shm->readonlydiff;
    310325
    311326    entry->hits  = 0;
     
    313328    entry->atime = XG(request_time);
    314329    stored_entry = type == XC_TYPE_PHP
    315         ? (xc_entry_t *) xc_processor_store_xc_entry_php_t(cache->shm->readonlydiff, cache->allocator, (xc_entry_php_t *) entry TSRMLS_CC)
    316         : (xc_entry_t *) xc_processor_store_xc_entry_var_t(cache->shm->readonlydiff, cache->allocator, (xc_entry_var_t *) entry TSRMLS_CC);
     330        ? (xc_entry_t *) xc_processor_store_xc_entry_php_t(&storage, (xc_entry_php_t *) entry TSRMLS_CC)
     331        : (xc_entry_t *) xc_processor_store_xc_entry_var_t(&storage, (xc_entry_var_t *) entry TSRMLS_CC);
    317332    if (stored_entry) {
    318333        xc_entry_add_unlocked(cache->cached, entryslotid, stored_entry);
Note: See TracChangeset for help on using the changeset viewer.