- Main Page
- Data Structures
- Files
- Related Pages

# generic.c File Reference

Generic - Definition. More...

`#include "generic.h"`
`#include <assert.h>`
`#include <stdlib.h>`
`#include <math.h>`

## Functions
char const * | vl_get_version_string ()
| Get version string.
static int | do_nothing_printf (char const *format,...)
| A printf that does not do anything.
void | vl_set_alloc_func (void *(*malloc_func)(vl_size), void *(*realloc_func)(void *, vl_size), void *(*calloc_func)(vl_size, vl_size), void(*free_func)(void *))
| Set memory allocation functions.
void | vl_set_printf_func (int(*printf_func)(char const *format,...))
| Set printf function.
## Variables
int | vl_err_no = 0
| Last error code.
char | vl_err_msg [VL_ERR_MSG_LEN] = ""
| Last error description.
void *(* | vl_malloc_func )(vl_size) = &malloc
| Customizable `malloc` function pointer.
void *(* | vl_realloc_func )(void *, vl_size) = &realloc
| Customizable `realloc` function pointer.
void *(* | vl_calloc_func )(vl_size, vl_size) = &calloc
| Customizable `calloc` function pointer.
void(* | vl_free_func )(void *) = &free
| Customizable `free` function pointer.
int(* | vl_printf_func )(char const *,...) = do_nothing_printf
| Customizable `printf` function pointer.

## Detailed Description

Author:
  Andrea Vedaldi

## Function Documentation

static int do_nothing_printf | ( | char const * | format,
|  |  | ... |
| ) |  |  | `[static]`

For internal use only.

char const* vl_get_version_string | ( |  | ) |

Returns:
  library version string

void vl_set_alloc_func | ( | void *(*)(vl_size) | malloc_func,
|  | void *(*)(void *, vl_size) | realloc_func,
|  | void *(*)(vl_size, vl_size) | calloc_func,
|  | void(*)(void *) | free_func |
| ) |  |  |

Parameters:

  | malloc_func | pointer to `malloc`.
  | realloc_func | pointer to `realloc`.
  | calloc_func | pointer to `calloc`.
  | free_func | pointer to `free`.

void vl_set_printf_func | ( | int(*)(char const *format,...) | printf_func | ) |

Parameters:

  | printf_func | pointer to `printf`. Let `print_func` be NULL to disable printf.

## Variable Documentation

void*(* vl_calloc_func)(vl_size, vl_size) = &calloc

For internal use only.

void(* vl_free_func)(void *) = &free

For internal use only.

void*(* vl_malloc_func)(vl_size) = &malloc

For internal use only.

int(* vl_printf_func)(char const *,...) = do_nothing_printf

For internal use only.

void*(* vl_realloc_func)(void *, vl_size) = &realloc

For internal use only.