#include <stdlib.h>
#include "log.h"
#include "support.h"
Go to the source code of this file.
|
void * | fc_real_malloc (size_t size, const char *called_as, int line, const char *file) fc__warn_unused_result |
|
void * | fc_real_realloc (void *ptr, size_t size, const char *called_as, int line, const char *file) fc__warn_unused_result |
|
void * | fc_real_calloc (size_t nelem, size_t elsize, const char *called_as, int line, const char *file) fc__warn_unused_result |
|
char * | real_fc_strdup (const char *str, const char *called_as, int line, const char *file) fc__warn_unused_result |
|
◆ fc_calloc
#define fc_calloc |
( |
|
n, |
|
|
|
esz |
|
) |
| |
Value:
void * fc_real_calloc(size_t nelem, size_t elsize, const char *called_as, int line, const char *file) fc__warn_unused_result
Definition at line 38 of file mem.h.
◆ FC_FREE
#define FC_FREE |
( |
|
ptr | ) |
do { free(ptr); (ptr) = NULL; } while (FALSE) |
Definition at line 41 of file mem.h.
◆ fc_malloc
Value:
void * fc_real_malloc(size_t size, const char *called_as, int line, const char *file) fc__warn_unused_result
Definition at line 34 of file mem.h.
◆ fc_realloc
#define fc_realloc |
( |
|
ptr, |
|
|
|
sz |
|
) |
| |
Value:
void * fc_real_realloc(void *ptr, size_t size, const char *called_as, int line, const char *file) fc__warn_unused_result
Definition at line 36 of file mem.h.
◆ fc_strdup
Definition at line 43 of file mem.h.
◆ fc_real_calloc()
void * fc_real_calloc |
( |
size_t |
nelem, |
|
|
size_t |
elsize, |
|
|
const char * |
called_as, |
|
|
int |
line, |
|
|
const char * |
file |
|
) |
| |
Function used by fc_calloc macro, calloc() replacement No need to check return value.
I'm pretty sure only the product of nelem and elsize can ever matter here, and not their individual values. (As a matter of C.) Except this function doesn't support calloc-ing more memory than can be expressing using a single size_t, but that's not likely to be a problem.
Definition at line 132 of file mem.c.
◆ fc_real_malloc()
void * fc_real_malloc |
( |
size_t |
size, |
|
|
const char * |
called_as, |
|
|
int |
line, |
|
|
const char * |
file |
|
) |
| |
Function used by fc_malloc macro, malloc() replacement
There's no need for the caller to check return value; this function will always return a valid pointer (even for a 0-byte malloc).
Definition at line 73 of file mem.c.
Referenced by fc_real_calloc(), fc_real_realloc(), and real_fc_strdup().
◆ fc_real_realloc()
void * fc_real_realloc |
( |
void * |
ptr, |
|
|
size_t |
size, |
|
|
const char * |
called_as, |
|
|
int |
line, |
|
|
const char * |
file |
|
) |
| |
Function used by fc_realloc macro, realloc() replacement No need to check return value.
Definition at line 101 of file mem.c.
◆ real_fc_strdup()
char * real_fc_strdup |
( |
const char * |
str, |
|
|
const char * |
called_as, |
|
|
int |
line, |
|
|
const char * |
file |
|
) |
| |
Function used by fc_strdup macro, strdup() replacement No need to check return value.
Definition at line 148 of file mem.c.