fixed bugs in xma.c

This commit is contained in:
2010-07-29 07:27:03 +00:00
parent f467ec9930
commit a1965a6544
8 changed files with 252 additions and 94 deletions

View File

@ -27,13 +27,18 @@
typedef struct qse_xma_t qse_xma_t;
typedef struct qse_xma_blk_t qse_xma_blk_t;
#define QSE_XMA_FIXED 32
#define QSE_XMA_SIZE_BITS ((QSE_SIZEOF_SIZE_T*8)-1)
struct qse_xma_t
{
QSE_DEFINE_COMMON_FIELDS (xma)
qse_xma_blk_t* head;
qse_xma_blk_t* xfree[100];
qse_xma_blk_t* xfree[QSE_XMA_FIXED + QSE_XMA_SIZE_BITS + 1];
qse_size_t bdec;
#ifdef QSE_XMA_ENABLE_STAT
struct
{
qse_size_t total;
@ -42,6 +47,7 @@ struct qse_xma_t
qse_size_t nused;
qse_size_t nfree;
} stat;
#endif
};
#ifdef __cplusplus
@ -75,6 +81,12 @@ void* qse_xma_alloc (
qse_size_t size
);
void* qse_xma_realloc (
qse_xma_t* xma,
void* b,
qse_size_t size
);
void qse_xma_free (
qse_xma_t* xma,
void* b

View File

@ -1,5 +1,5 @@
/*
* $Id: types.h 287 2009-09-15 10:01:02Z hyunghwan.chung $
* $Id: types.h 337 2010-07-28 13:27:03Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
This file is part of QSE.
@ -239,10 +239,12 @@ typedef qse_uint8_t qse_byte_t;
* The qse_size_t type defines an unsigned integer type that is as large as
* to hold a pointer value.
*/
#ifdef __SIZE_TYPE__
#if defined(__SIZE_TYPE__) && defined(__SIZEOF_SIZE_T__)
typedef __SIZE_TYPE__ qse_size_t;
# define QSE_SIZEOF_SIZE_T __SIZEOF_SIZE_T__
#else
typedef qse_uint_t qse_size_t;
# define QSE_SIZEOF_SIZE_T QSE_SIZEOF_INT_T
#endif
/**