Updated interface for user-data
This commit was SVN r5952.
Этот коммит содержится в:
родитель
05233256ee
Коммит
0b41dd278a
@ -30,12 +30,12 @@ struct mca_allocator_base_module_t;
|
||||
/**
|
||||
* The allocate function typedef for the function to be provided by the component.
|
||||
*/
|
||||
typedef void* (*mca_allocator_base_module_alloc_fn_t)(struct mca_allocator_base_module_t*, size_t size, size_t align, void* user_out);
|
||||
typedef void* (*mca_allocator_base_module_alloc_fn_t)(struct mca_allocator_base_module_t*, size_t size, size_t align, void** user_out);
|
||||
|
||||
/**
|
||||
* The realloc function typedef
|
||||
*/
|
||||
typedef void* (*mca_allocator_base_module_realloc_fn_t)(struct mca_allocator_base_module_t*, void*, size_t, void* user_out);
|
||||
typedef void* (*mca_allocator_base_module_realloc_fn_t)(struct mca_allocator_base_module_t*, void*, size_t, void** user_out);
|
||||
|
||||
/**
|
||||
* Free function typedef
|
||||
@ -87,7 +87,7 @@ typedef struct mca_allocator_base_module_t mca_allocator_base_module_t;
|
||||
* provided by the module to the allocator framework.
|
||||
*/
|
||||
|
||||
typedef void* (*mca_allocator_base_component_segment_alloc_fn_t)(size_t* size, void* user_in, void* user_out);
|
||||
typedef void* (*mca_allocator_base_component_segment_alloc_fn_t)(size_t* size, void* user_in, void** user_out);
|
||||
|
||||
/**
|
||||
* A function to free memory from the control of the allocator framework
|
||||
|
@ -161,7 +161,7 @@ void *mca_allocator_basic_alloc(
|
||||
mca_allocator_base_module_t * base,
|
||||
size_t size,
|
||||
size_t align,
|
||||
void* user_out)
|
||||
void** user_out)
|
||||
{
|
||||
mca_allocator_basic_module_t* module = (mca_allocator_basic_module_t*)base;
|
||||
mca_allocator_basic_segment_t* seg;
|
||||
@ -241,7 +241,7 @@ void * mca_allocator_basic_realloc(
|
||||
mca_allocator_base_module_t * base,
|
||||
void * ptr,
|
||||
size_t size,
|
||||
void* user_out)
|
||||
void** user_out)
|
||||
{
|
||||
unsigned char* addr = ((unsigned char*)ptr) - sizeof(size_t);
|
||||
size_t alloc_size = *(size_t*)addr;
|
||||
|
@ -92,7 +92,7 @@ mca_allocator_base_module_t* mca_allocator_basic_component_init(
|
||||
mca_allocator_base_module_t * mem,
|
||||
size_t size,
|
||||
size_t align,
|
||||
void* user_out);
|
||||
void** user_out);
|
||||
|
||||
/**
|
||||
* Attempts to resize the passed region of memory into a larger or a smaller
|
||||
@ -112,7 +112,7 @@ mca_allocator_base_module_t* mca_allocator_basic_component_init(
|
||||
mca_allocator_base_module_t * mem,
|
||||
void * ptr,
|
||||
size_t size,
|
||||
void* user_out);
|
||||
void** user_out);
|
||||
|
||||
/**
|
||||
* Frees the passed region of memory
|
||||
|
@ -32,7 +32,7 @@ int mca_allocator_bucket_module_open(void);
|
||||
int mca_allocator_bucket_module_close(void);
|
||||
|
||||
void * mca_allocator_bucket_alloc_wrapper(struct mca_allocator_base_module_t* allocator,
|
||||
size_t size, size_t align, void* user_out);
|
||||
size_t size, size_t align, void** user_out);
|
||||
static int mca_allocator_num_buckets;
|
||||
|
||||
|
||||
@ -83,7 +83,7 @@ int mca_allocator_bucket_module_close(void) {
|
||||
}
|
||||
|
||||
void * mca_allocator_bucket_alloc_wrapper(struct mca_allocator_base_module_t* allocator,
|
||||
size_t size, size_t align, void* user_out)
|
||||
size_t size, size_t align, void** user_out)
|
||||
{
|
||||
if(0 == align){
|
||||
return(mca_allocator_bucket_alloc(allocator, size, user_out));
|
||||
|
@ -68,7 +68,7 @@ mca_allocator_bucket_t * mca_allocator_bucket_init(mca_allocator_base_module_t *
|
||||
*
|
||||
*/
|
||||
void * mca_allocator_bucket_alloc(mca_allocator_base_module_t * mem,
|
||||
size_t size, void* user_out)
|
||||
size_t size, void** user_out)
|
||||
{
|
||||
mca_allocator_bucket_t * mem_options = (mca_allocator_bucket_t *) mem;
|
||||
/* initialize for the later bit shifts */
|
||||
@ -148,7 +148,7 @@ void * mca_allocator_bucket_alloc(mca_allocator_base_module_t * mem,
|
||||
* allocates an aligned region of memory
|
||||
*/
|
||||
void * mca_allocator_bucket_alloc_align(mca_allocator_base_module_t * mem,
|
||||
size_t size, size_t alignment, void* user_out)
|
||||
size_t size, size_t alignment, void** user_out)
|
||||
{
|
||||
mca_allocator_bucket_t * mem_options = (mca_allocator_bucket_t *) mem;
|
||||
int bucket_num = 1;
|
||||
@ -228,7 +228,7 @@ void * mca_allocator_bucket_alloc_align(mca_allocator_base_module_t * mem,
|
||||
* function to reallocate the segment of memory
|
||||
*/
|
||||
void * mca_allocator_bucket_realloc(mca_allocator_base_module_t * mem,
|
||||
void * ptr, size_t size, void* user_out)
|
||||
void * ptr, size_t size, void** user_out)
|
||||
{
|
||||
mca_allocator_bucket_t * mem_options = (mca_allocator_bucket_t *) mem;
|
||||
/* initialize for later bit shifts */
|
||||
|
@ -122,7 +122,7 @@ typedef struct mca_allocator_bucket_t mca_allocator_bucket_t;
|
||||
* @retval Pointer to the area of memory if the allocation was successful
|
||||
* @retval NULL if the allocation was unsuccessful
|
||||
*/
|
||||
void * mca_allocator_bucket_alloc(mca_allocator_base_module_t * mem, size_t size, void* user_out);
|
||||
void * mca_allocator_bucket_alloc(mca_allocator_base_module_t * mem, size_t size, void** user_out);
|
||||
|
||||
/**
|
||||
* Accepts a request for memory in a specific region defined by the
|
||||
@ -140,7 +140,7 @@ typedef struct mca_allocator_bucket_t mca_allocator_bucket_t;
|
||||
*
|
||||
*/
|
||||
void * mca_allocator_bucket_alloc_align(mca_allocator_base_module_t * mem,
|
||||
size_t size, size_t alignment, void* user_out);
|
||||
size_t size, size_t alignment, void** user_out);
|
||||
|
||||
/**
|
||||
* Attempts to resize the passed region of memory into a larger or a smaller
|
||||
@ -157,7 +157,7 @@ typedef struct mca_allocator_bucket_t mca_allocator_bucket_t;
|
||||
*
|
||||
*/
|
||||
void * mca_allocator_bucket_realloc(mca_allocator_base_module_t * mem,
|
||||
void * ptr, size_t size, void* user_out);
|
||||
void * ptr, size_t size, void** user_out);
|
||||
|
||||
/**
|
||||
* Frees the passed region of memory
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user