|
YAZ 5.35.1
|
Header for memory handling functions. More...
Go to the source code of this file.
Macros | |
| #define | xrealloc(o, x) xrealloc_f(o, x, __FILE__, __LINE__) |
| utility macro which calls xrealloc_f | |
| #define | xmalloc(x) xmalloc_f(x, __FILE__, __LINE__) |
| utility macro which calls malloc_f | |
| #define | xcalloc(x, y) xcalloc_f(x,y, __FILE__, __LINE__) |
| utility macro which calls xcalloc_f | |
| #define | xfree(x) xfree_f(x, __FILE__, __LINE__) |
| utility macro which calls xfree_f | |
| #define | xstrdup(s) xstrdup_f(s, __FILE__, __LINE__) |
| utility macro which calls xstrdup_f | |
| #define | xstrndup(s, n) xstrndup_f(s, n, __FILE__, __LINE__) |
| utility macro which calls xstrndup_f | |
| #define | xmalloc_trav(s) xmalloc_trav_f(s, __FILE__, __LINE__) |
| utility macro which calls malloc_trav_f | |
Functions | |
| void * | xrealloc_f (void *o, size_t size, const char *file, int line) |
| realloc | |
| void * | xmalloc_f (size_t size, const char *file, int line) |
| malloc | |
| void * | xcalloc_f (size_t nmemb, size_t size, const char *file, int line) |
| calloc | |
| char * | xstrdup_f (const char *p, const char *file, int line) |
| strdup | |
| char * | xstrndup_f (const char *p, size_t n, const char *file, int line) |
| strndup | |
| void | xfree_f (void *p, const char *file, int line) |
| free | |
| void | xmalloc_trav_f (const char *s, const char *file, int line) |
| logs all xmalloc buffers | |
Header for memory handling functions.
This is a set of wrapper functions for the memory allocation routines from stdlib.h.. Such as malloc, free, realloc etc. These functions calls exit if memory allocation fails.
Definition in file xmalloc.h.
| #define xfree | ( | x | ) | xfree_f(x, __FILE__, __LINE__) |
| #define xmalloc | ( | x | ) | xmalloc_f(x, __FILE__, __LINE__) |
| #define xmalloc_trav | ( | s | ) | xmalloc_trav_f(s, __FILE__, __LINE__) |
| #define xrealloc | ( | o, | |
| x | |||
| ) | xrealloc_f(o, x, __FILE__, __LINE__) |
| #define xstrdup | ( | s | ) | xstrdup_f(s, __FILE__, __LINE__) |
| #define xstrndup | ( | s, | |
| n | |||
| ) | xstrndup_f(s, n, __FILE__, __LINE__) |
| void * xcalloc_f | ( | size_t | nmemb, |
| size_t | size, | ||
| const char * | file, | ||
| int | line | ||
| ) |
calloc
| nmemb | number of members |
| size | size of member |
| file | fname location of use |
| line | line location of use |
This function is invoked via macro xcalloc in which file and line are set automatically.
Definition at line 302 of file xmalloc.c.
References log_level, log_level_initialized, xcalloc_d, xmalloc_fatal(), yaz_log(), yaz_log_module_level(), and YLOG_FATAL.
| void xfree_f | ( | void * | p, |
| const char * | file, | ||
| int | line | ||
| ) |
| void * xmalloc_f | ( | size_t | size, |
| const char * | file, | ||
| int | line | ||
| ) |
malloc
| size | size of buffer to be allocated |
| file | fname location of use |
| line | line location of use |
This function is invoked via macro xmalloc in which file and line are set automatically.
Definition at line 279 of file xmalloc.c.
References log_level, log_level_initialized, xmalloc_d, xmalloc_fatal(), yaz_log(), yaz_log_module_level(), and YLOG_FATAL.
Referenced by xstrndup_f().
| void xmalloc_trav_f | ( | const char * | s, |
| const char * | file, | ||
| int | line | ||
| ) |
logs all xmalloc buffers
| s | not used |
| file | fname location of use |
| line | line location of use |
This function is invoked via macro xmalloc_trav in which file and line are set automatically. Only if TRACE_XMALLOC > 1 this function does any real work!
Definition at line 240 of file xmalloc.c.
References log_level, log_level_initialized, xmalloc_trav_d, and yaz_log_module_level().
| void * xrealloc_f | ( | void * | o, |
| size_t | size, | ||
| const char * | file, | ||
| int | line | ||
| ) |
realloc
| o | buffer to be reallocated |
| size | size of buffer to be allocated |
| file | fname location of use |
| line | line location of use |
This function is invoked via macro xrealloc in which file and line are set automatically.
Definition at line 257 of file xmalloc.c.
References log_level, log_level_initialized, xmalloc_fatal(), xrealloc_d, yaz_log(), yaz_log_module_level(), and YLOG_FATAL.
| char * xstrdup_f | ( | const char * | p, |
| const char * | file, | ||
| int | line | ||
| ) |
strdup
| p | string to be cloned |
| file | fname location of use |
| line | line location of use |
This function is invoked via macro xstrdup in which file and line are set automatically.
Definition at line 324 of file xmalloc.c.
References log_level, log_level_initialized, xmalloc_d, yaz_log(), and yaz_log_module_level().
Referenced by xstrndup_f().
| char * xstrndup_f | ( | const char * | p, |
| size_t | n, | ||
| const char * | file, | ||
| int | line | ||
| ) |
strndup
| p | string to be cloned |
| n | max size of resulting string (excluding 0) |
| file | fname location of use |
| line | line location of use |
This function is invoked via macro xstrndup in which file and line are set automatically.
Definition at line 350 of file xmalloc.c.
References xmalloc_f(), and xstrdup_f().