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

cbmimage: allocation functions More...

#include "cbmimage/alloc.h"
#include "cbmimage/internal.h"
#include <stdlib.h>
#include <string.h>
Include dependency graph for alloc.c:

Functions

static void * cbmimage_ii_xalloc (size_t size)
 
static void cbmimage_ii_xfree (void *ptr)
 
static void * cbmimage_ii_xalloc_and_copy (size_t newsize, const void *oldbuffer, size_t oldsize)
 
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 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
 

Variables

static cbmimage_alloc_xalloc_function_typecbmimage_i_alloc_xalloc_function = cbmimage_ii_xalloc
 pointer to the callback function for cbmimage_i_xalloc()
 
static cbmimage_alloc_xalloc_and_copy_function_typecbmimage_i_alloc_xalloc_and_copy_function = cbmimage_ii_xalloc_and_copy
 pointer to the callback function for cbmimage_i_xalloc_and_copy()
 
static cbmimage_alloc_xfree_function_typecbmimage_i_alloc_xfree_function = cbmimage_ii_xfree
 pointer to the callback function for cbmimage_i_xfree()
 

Detailed Description

cbmimage: allocation functions


Author
Spiro Trikaliotis

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