summaryrefslogtreecommitdiff
path: root/processor
diff options
context:
space:
mode:
authorXuefer <xuefer@gmail.com>2013-11-12 10:08:17 +0000
committerXuefer <xuefer@gmail.com>2013-11-12 10:08:17 +0000
commite317146c8bc808bfcbe0f695b11c5ea0000e75be (patch)
tree6cc83fc3dd8951f7c56cc51abe579694c2c694a1 /processor
parent5ae45a143a941c3be8c26f4538a5b977e90994e5 (diff)
downloadxcache-e317146c8bc808bfcbe0f695b11c5ea0000e75be.tar.gz
xcache-e317146c8bc808bfcbe0f695b11c5ea0000e75be.zip
processor: abstract store target (storage)
git-svn-id: svn://svn.lighttpd.net/xcache/trunk@1470 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
Diffstat (limited to 'processor')
-rw-r--r--processor/foot.m410
1 files changed, 7 insertions, 3 deletions
diff --git a/processor/foot.m4 b/processor/foot.m4
index a774978..f6f39cb 100644
--- a/processor/foot.m4
+++ b/processor/foot.m4
@@ -1,12 +1,16 @@
+dnl {{{ xc_store_target
+EXPORT(`typedef void *(*xc_processor_storage_allocator_t)(void *data, size_t size);')
+EXPORT(`typedef struct { xc_processor_storage_allocator_t allocator; void *allocator_data; ptrdiff_t relocatediff; } xc_processor_storage_t;')
+dnl }}}
define(`DEFINE_STORE_API', `
-EXPORTED_FUNCTION(`$1 *xc_processor_store_$1(ptrdiff_t relocatediff, xc_allocator_t *allocator, $1 *src TSRMLS_DC)') dnl {{{
+EXPORTED_FUNCTION(`$1 *xc_processor_store_$1(const xc_processor_storage_t *storage, $1 *src TSRMLS_DC)') dnl {{{
{
$1 *dst;
xc_processor_t processor;
memset(&processor, 0, sizeof(processor));
processor.handle_reference = 1;
- processor.relocatediff = relocatediff;
+ processor.relocatediff = storage->relocatediff;
IFAUTOCHECK(`xc_stack_init(&processor.allocsizes);')
@@ -44,7 +48,7 @@ EXPORTED_FUNCTION(`$1 *xc_processor_store_$1(ptrdiff_t relocatediff, xc_allocato
}
/* allocator :) */
- processor.p = (char *) allocator->vtable->malloc(allocator, processor.size);
+ processor.p = (char *) storage->allocator(storage->allocator_data, processor.size);
if (processor.p == NULL) {
dst = NULL;
goto err_alloc;