- Timestamp:
- 2013-11-12T10:08:17Z (5 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/mod_cacher/xc_cacher.c
r1468 r1470 160 160 static void xc_holds_destroy(TSRMLS_D); 161 161 162 static 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 162 169 /* any function in *_unlocked is only safe be called within locked (single thread access) area */ 163 170 … … 173 180 { 174 181 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; 175 186 176 187 php->hits = 0; 177 188 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); 179 190 #if 0 180 191 { … … 308 319 { 309 320 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; 310 325 311 326 entry->hits = 0; … … 313 328 entry->atime = XG(request_time); 314 329 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); 317 332 if (stored_entry) { 318 333 xc_entry_add_unlocked(cache->cached, entryslotid, stored_entry); -
trunk/processor/foot.m4
r1468 r1470 1 dnl {{{ xc_store_target 2 EXPORT(`typedef void *(*xc_processor_storage_allocator_t)(void *data, size_t size);') 3 EXPORT(`typedef struct { xc_processor_storage_allocator_t allocator; void *allocator_data; ptrdiff_t relocatediff; } xc_processor_storage_t;') 4 dnl }}} 1 5 define(`DEFINE_STORE_API', ` 2 EXPORTED_FUNCTION(`$1 *xc_processor_store_$1( ptrdiff_t relocatediff, xc_allocator_t *allocator, $1 *src TSRMLS_DC)') dnl {{{6 EXPORTED_FUNCTION(`$1 *xc_processor_store_$1(const xc_processor_storage_t *storage, $1 *src TSRMLS_DC)') dnl {{{ 3 7 { 4 8 $1 *dst; … … 7 11 memset(&processor, 0, sizeof(processor)); 8 12 processor.handle_reference = 1; 9 processor.relocatediff = relocatediff;13 processor.relocatediff = storage->relocatediff; 10 14 11 15 IFAUTOCHECK(`xc_stack_init(&processor.allocsizes);') … … 45 49 46 50 /* allocator :) */ 47 processor.p = (char *) allocator->vtable->malloc(allocator, processor.size);51 processor.p = (char *) storage->allocator(storage->allocator_data, processor.size); 48 52 if (processor.p == NULL) { 49 53 dst = NULL;
Note: See TracChangeset
for help on using the changeset viewer.