Files
RedScarfEngine/utilities/rse_commons.h
T
Piotr Krygier f5ab5f3f27 Improve testing framework
Replaced Criterrion with CMock. Added few tests, currently not working
properly. Random test upgrades.
2025-06-20 13:44:33 +02:00

46 lines
1.1 KiB
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 "utilities/locale_common.h"
#include <stdint.h>
/**
* @brief Macro for allocating memory and checking it on the same line
*
*/
#ifndef RSE_TEST
#define rse_malloc(ptr, size) \
ptr = malloc(size); \
if (ptr == NULL) { \
LOGF(common_messages[COMMON_ERROR_MEMORY_ALLOCATION_FAILED]); \
exit(1); \
}
#define rse_free(ptr) free(ptr);
#define rse_memcpy(dst, src, size) memcpy(dst, src, size);
#else
#define rse_malloc(ptr, size) ptr = NULL;
#define rse_free(ptr)
#define rse_memcpy(dst, src, size)
#endif
/**
* @brief Error type for RSE
*
*/
typedef uint32_t rse_err_t;
#endif /* RSE_COMMONS_H */