Crealned up some TODOs, FIXMEs etc. Added better error handling. Looks better, feels better.
34 lines
837 B
C
34 lines
837 B
C
/**
|
|
* @file rse_commons.h
|
|
* @author Piotr Krygier (everyonecancode@gmail.com)
|
|
* @brief Common functionality for all modules
|
|
* @version 0.1
|
|
* @date 2023-10-05
|
|
*
|
|
* @copyright Copyright (c) 2023
|
|
*
|
|
*/
|
|
|
|
#ifndef RSE_COMMONS_H
|
|
#define RSE_COMMONS_H
|
|
|
|
#include <stdint.h>
|
|
|
|
/**
|
|
* @brief Macro for allocating memory and checking it on the same line
|
|
*
|
|
*/
|
|
#define rse_malloc(ptr, size) \
|
|
ptr = malloc(size); \
|
|
if (ptr == NULL) { \
|
|
LOGF(common_messages[COMMON_ERROR_MEMORY_ALLOCATION_FAILED]); \
|
|
return RSE_COMMON_ERROR_MALLLOC_FAILED; \
|
|
}
|
|
|
|
/**
|
|
* @brief Error type for RSE
|
|
*
|
|
*/
|
|
typedef uint32_t rse_err_t;
|
|
|
|
#endif /* RSE_COMMONS_H */ |