Boilerplate project with CLion for stm32f103 bluepill
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
515 B

8 years ago
#ifndef MPORK_MALLOC_SAFE_H
#define MPORK_MALLOC_SAFE_H
/**
* Malloc that prints error and restarts the system on failure.
*/
#include <common.h>
#include <stm32f1xx_hal.h>
void *malloc_safe_do(size_t size, const char* file, uint32_t line);
void *calloc_safe_do(size_t nmemb, size_t size, const char* file, uint32_t line);
#define malloc_s(size) malloc_safe_do(size, __FILE__, __LINE__)
#define calloc_s(nmemb, size) calloc_safe_do(nmemb, size, __FILE__, __LINE__)
#endif //MPORK_MALLOC_SAFE_H