standard C string functions, which is made NULL safe by checking if input value is NULL before performing the action. More...
#include <stdio.h>#include <stdlib.h>#include <eurephia_context.h>#include <eurephia_log.h>
Include dependency graph for eurephia_nullsafe.c:Go to the source code of this file.
Functions | |
| void * | _malloc_nullsafe (eurephiaCTX *ctx, size_t sz, const char *file, int line) |
| void | _free_nullsafe (eurephiaCTX *ctx, void *ptr, const char *file, int line) |
standard C string functions, which is made NULL safe by checking if input value is NULL before performing the action.
Definition in file eurephia_nullsafe.c.
| void _free_nullsafe | ( | eurephiaCTX * | ctx, | |
| void * | ptr, | |||
| const char * | file, | |||
| int | line | |||
| ) | [inline] |
Internal function for freeing memory. Also does some logging of the freeing if debug level enabled and log level high enough. Should be called via the free_nullsafe() macro.
| ctx | eurephiaCTX (for logging only) | |
| ptr | Pointer to the memory region to be freed | |
| file | debug info, which file is doing this call | |
| line | debug info, which line in the file |
< Messages intended when debugging. Only for log level > 10
Definition at line 97 of file eurephia_nullsafe.c.
Here is the call graph for this function:| void* _malloc_nullsafe | ( | eurephiaCTX * | ctx, | |
| size_t | sz, | |||
| const char * | file, | |||
| int | line | |||
| ) |
Internal function, should be called via the malloc_nullsafe() macro. This replaces the use of malloc() and memset(). This function uses calloc internally, which results in the memory region being zero'd by the kernel on memory allocation.
| ctx | eurephiaCTX, used for logging | |
| sz | size of the memory region being allocated | |
| file | debug info, which file is doing this call | |
| line | debug info, which line in the file |
< Alias for LOG_FATAL
< Operation failed and cannot continue. Log level always < 2
< Messages intended when debugging. Only for log level > 10
Definition at line 60 of file eurephia_nullsafe.c.
Here is the call graph for this function:
1.7.1