diff options
author | Xuefer <xuefer@gmail.com> | 2013-09-23 07:23:19 +0000 |
---|---|---|
committer | Xuefer <xuefer@gmail.com> | 2013-09-23 07:23:19 +0000 |
commit | f7035318b77a345d4e580a77ef4f2cfdd9501045 (patch) | |
tree | 14781482f65d312b3cbcc3a102ab5e4f628fa233 /xcache | |
parent | 563cbeedd2ef6a5b7b249983b2de20eba06d1480 (diff) | |
download | xcache-f7035318b77a345d4e580a77ef4f2cfdd9501045.tar.gz xcache-f7035318b77a345d4e580a77ef4f2cfdd9501045.zip |
fix xtest
git-svn-id: svn://svn.lighttpd.net/xcache/trunk@1391 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
Diffstat (limited to 'xcache')
-rw-r--r-- | xcache/xc_allocator.c | 8 | ||||
-rw-r--r-- | xcache/xc_allocator_bestfit.c | 7 | ||||
-rw-r--r-- | xcache/xc_malloc.c | 2 |
3 files changed, 11 insertions, 6 deletions
diff --git a/xcache/xc_allocator.c b/xcache/xc_allocator.c index 3a6226a..2f6a8b2 100644 --- a/xcache/xc_allocator.c +++ b/xcache/xc_allocator.c @@ -1,4 +1,10 @@ -#include "xcache.h" +#ifdef TEST +# ifdef HAVE_CONFIG_H +# include <config.h> +# endif +#else +# include "xcache.h" +#endif #include "xc_allocator.h" #include <string.h> #include <stdio.h> diff --git a/xcache/xc_allocator_bestfit.c b/xcache/xc_allocator_bestfit.c index 54b88db..2d4fd91 100644 --- a/xcache/xc_allocator_bestfit.c +++ b/xcache/xc_allocator_bestfit.c @@ -53,13 +53,10 @@ typedef struct _xc_allocator_bestfit_t { xc_allocator_bestfit_block_t headblock[1]; /* just as a pointer to first block*/ } xc_allocator_bestfit_t; -#ifndef XtOffsetOf -# include <linux/stddef.h> -# define XtOffsetOf(s_type, field) offsetof(s_type, field) -#endif +#include <stddef.h> #define SizeOf(type, field) sizeof( ((type *) 0)->field ) -#define BLOCK_HEADER_SIZE() (ALIGN( XtOffsetOf(xc_allocator_bestfit_block_t, size) + SizeOf(xc_allocator_bestfit_block_t, size) )) +#define BLOCK_HEADER_SIZE() (ALIGN( offsetof(xc_allocator_bestfit_block_t, size) + SizeOf(xc_allocator_bestfit_block_t, size) )) #define BLOCK_MAGIC ((unsigned int) 0x87655678) diff --git a/xcache/xc_malloc.c b/xcache/xc_malloc.c index 5ff521c..5c48ed1 100644 --- a/xcache/xc_malloc.c +++ b/xcache/xc_malloc.c @@ -221,7 +221,9 @@ static XC_SHM_MEMDESTROY(xc_malloc_memdestroy) /* {{{ */ /* }}} */ static xc_allocator_vtable_t xc_allocator_malloc_vtable = XC_ALLOCATOR_VTABLE(allocator_malloc); +#ifndef TEST static xc_shm_handlers_t xc_shm_malloc_handlers = XC_SHM_HANDLERS(malloc); +#endif void xc_allocator_malloc_register() /* {{{ */ { if (xc_allocator_register("malloc", &xc_allocator_malloc_vtable) == 0) { |