cbmimage
Loading...
Searching...
No Matches
alloc.h File Reference

cbmimage alloc function definitions More...

#include <stddef.h>
Include dependency graph for alloc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef void * cbmimage_alloc_xalloc_function_type(size_t size)
 Type for a cbmimage_i_xalloc() style callback.
 
typedef void * cbmimage_alloc_xalloc_and_copy_function_type(size_t newsize, const void *oldbuffer, size_t oldsize)
 Type for a cbmimage_i_xalloc_and_copy() style callback.
 
typedef void cbmimage_alloc_xfree_function_type(void *ptr)
 Type for a cbmimage_i_xfree() style callback.
 

Functions

void * cbmimage_i_xalloc (size_t size)
 
void cbmimage_i_xfree (void *ptr)
 
void * cbmimage_i_xalloc_and_copy (size_t newsize, const void *oldbuffer, size_t oldsize)
 
int cbmimage_alloc_set_functions (cbmimage_alloc_xalloc_function_type, cbmimage_alloc_xfree_function_type, cbmimage_alloc_xalloc_and_copy_function_type)
 set the callback for output from the library
 

Detailed Description

cbmimage alloc function definitions


Author
Spiro Trikaliotis

Typedef Documentation

◆ cbmimage_alloc_xalloc_and_copy_function_type

typedef void * cbmimage_alloc_xalloc_and_copy_function_type(size_t newsize, const void *oldbuffer, size_t oldsize)

Type for a cbmimage_i_xalloc_and_copy() style callback.

Used with cbmimage_set_alloc_functions()

◆ cbmimage_alloc_xalloc_function_type

typedef void * cbmimage_alloc_xalloc_function_type(size_t size)

Type for a cbmimage_i_xalloc() style callback.

Used with cbmimage_set_alloc_functions()

◆ cbmimage_alloc_xfree_function_type

typedef void cbmimage_alloc_xfree_function_type(void *ptr)

Type for a cbmimage_i_xfree() style callback.

Used with cbmimage_set_alloc_functions()

Function Documentation

◆ cbmimage_alloc_set_functions()

int cbmimage_alloc_set_functions ( cbmimage_alloc_xalloc_function_type xalloc_function,
cbmimage_alloc_xfree_function_type xfree_function,
cbmimage_alloc_xalloc_and_copy_function_type xalloc_and_copy_function )

set the callback for output from the library

Parameters
[in]xalloc_functionpointer to the function that is called whenever the library wants to xalloc() something

If this is set to NULL, then a library internal xalloc() is used

Parameters
[in]xfree_functionpointer to the function that is called whenever the library wants to xfree() something

If this is set to NULL, then a library internal xfree() is used

Parameters
[in]xalloc_and_copy_functionpointer to the function that is called whenever the library wants to xalloc_and_copy() something

If this is set to NULL, then a library internal xalloc_and_copy() is used

Remarks
  • xalloc_function and xfree_function must correspond to each other. Because of this, do not set one of these functions, but not the other!
  • If xalloc_and_copy_function is set, it must correspond to xalloc_function, too. However, if it is not defined (= NULL), then an internal implementation is used that used xalloc_function; thus, in this case, the usage is safe