summaryrefslogtreecommitdiff
path: root/processor
diff options
context:
space:
mode:
authorXuefer <xuefer@gmail.com>2013-11-13 05:01:22 +0000
committerXuefer <xuefer@gmail.com>2013-11-13 05:01:22 +0000
commit7c5c7c2161d2113225ab41a7379d3aa917cb6d30 (patch)
tree13706bca8373c05486f9f3686efae81cce10a3bf /processor
parent8f51668e2ecd35f1c6be18797315673a97c96761 (diff)
downloadxcache-7c5c7c2161d2113225ab41a7379d3aa917cb6d30.tar.gz
xcache-7c5c7c2161d2113225ab41a7379d3aa917cb6d30.zip
relocate: fix ifrelocate()
git-svn-id: svn://svn.lighttpd.net/xcache/trunk@1474 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
Diffstat (limited to 'processor')
-rw-r--r--processor/hashtable.m49
-rw-r--r--processor/main.m44
-rw-r--r--processor/struct.m44
3 files changed, 8 insertions, 9 deletions
diff --git a/processor/hashtable.m4 b/processor/hashtable.m4
index d76ee6a..9df3835 100644
--- a/processor/hashtable.m4
+++ b/processor/hashtable.m4
@@ -47,12 +47,11 @@ define(`DEF_HASH_TABLE_FUNC', `DEF_STRUCT_P_FUNC(`HashTable', `$1', `
', ` dnl IFDASM else
dnl }}}
Bucket *srcBucket;
- IFRELOCATE(`Bucket *next;')
+ IFCOPY(`Bucket *first = NULL, *last = NULL;')
IFRELOCATE(`Bucket *dstBucket = NULL;')
- IFCOPY(`Bucket *dstBucket = NULL, *first = NULL, *last = NULL;')
- dnl only used for copy
- IFCOPY(`uint n;')
+ IFRESTORE(`Bucket *dstBucket = NULL;')
IFRELOCATE(`uint n;')
+ IFRESTORE(`uint n;')
IFCALCCOPY(`size_t bucketSize;')
#if defined(HARDENING_PATCH_HASH_PROTECT) && HARDENING_PATCH_HASH_PROTECT
@@ -147,7 +146,7 @@ define(`DEF_HASH_TABLE_FUNC', `DEF_STRUCT_P_FUNC(`HashTable', `$1', `
IFRELOCATE(`
for (n = 0; n < SRC(`nTableSize'); ++n) {
if (SRC(`arBuckets[n]')) {
- next = PTR_FROM_VIRTUAL_EX(`Bucket', `DST(`arBuckets[n]')');
+ Bucket *next = PTR_FROM_VIRTUAL_EX(`Bucket', `DST(`arBuckets[n]')');
do {
dstBucket = next;
next = PTR_FROM_VIRTUAL_EX(`Bucket', `next->pNext');
diff --git a/processor/main.m4 b/processor/main.m4
index 7b7c43b..1a9e98f 100644
--- a/processor/main.m4
+++ b/processor/main.m4
@@ -241,8 +241,8 @@ define(`IFCALCSTORE', `IFSTORE(`$1', `IFCALC(`$1', `$2')')')
define(`IFRESTORE', `ifelse(PROCESSOR_TYPE, `restore', `$1', `$2')')
define(`IFCOPY', `IFSTORE(`$1', `IFRESTORE(`$1', `$2')')')
define(`IFCALCCOPY', `IFCALC(`$1', `IFCOPY(`$1', `$2')')')
-define(`IFRELOCATE', `ifelse(PROCESSOR_TYPE, `relocate', `$1', `$2')')
-define(`IFRELOCATE', `IFSTORE(`$1', `IFRELOCATE(`$1', `$2')')')
+define(`IFRELOCATEONLY', `ifelse(PROCESSOR_TYPE, `relocate', `$1', `$2')')
+define(`IFRELOCATE', `IFSTORE(`$1', `IFRELOCATEONLY(`$1', `$2')')')
define(`IFDPRINT', `ifelse(PROCESSOR_TYPE, `dprint', `$1', `$2')')
define(`IFDASM', `ifelse(PROCESSOR_TYPE, `dasm', `$1', `$2')')
dnl }}}
diff --git a/processor/struct.m4 b/processor/struct.m4
index 7cd003e..fb2d7d1 100644
--- a/processor/struct.m4
+++ b/processor/struct.m4
@@ -14,7 +14,7 @@ define(`DECL_STRUCT_P_FUNC', `translit(
IFCALC( `xc_processor_t *processor, const $1 * const src')
IFSTORE( `xc_processor_t *processor, $1 *dst, const $1 * const src')
IFRESTORE(`xc_processor_t *processor, $1 *dst, const $1 * const src')
- IFRELOCATE(`$1 *const dst, ptrdiff_t ptrdiff, ptrdiff_t relocatediff')
+ IFRELOCATEONLY(`$1 *const dst, ptrdiff_t ptrdiff, ptrdiff_t relocatediff')
IFDASM(`xc_dasm_t *dasm, zval *dst, const $1 * const src')
TSRMLS_DC
)ifelse(`$3', `', `;')
@@ -147,7 +147,7 @@ ifdef(`DASM_STRUCT_DIRECT', `', `
IFCALC( `processor, $6 $3')
IFSTORE( `processor, $6 $2, $6 $3')
IFRESTORE(`processor, $6 $2, $6 $3')
- IFRELOCATE(`
+ IFRELOCATEONLY(`
ifelse(`$6', `', `PTR_FROM_VIRTUAL_EX(`$1', `$3')', `$6 $3')
, ptrdiff
, relocatediff