Freeciv-3.2
|
Go to the source code of this file.
Macros | |
#define | fc_malloc(sz) |
#define | fc_realloc(ptr, sz) |
#define | fc_calloc(n, esz) |
#define | FC_FREE(ptr) do { free(ptr); (ptr) = NULL; } while (FALSE) |
#define | fc_strdup(str) real_fc_strdup((str), "strdup", __FC_LINE__, __FILE__) |
Functions | |
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 |
#define fc_strdup | ( | str | ) | real_fc_strdup((str), "strdup", __FC_LINE__, __FILE__) |
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.
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().