Consistent furi_assert usage across project. (#392)

This commit is contained in:
あく
2021-03-31 21:05:00 +03:00
committed by GitHub
parent 81ace53cc1
commit 6fb6e8bd3f
9 changed files with 31 additions and 31 deletions

View File

@@ -28,14 +28,12 @@ extern "C" {
// We have two levels of assertion
// One - furi_check, which always runs, the only difference is in the level of debug information
// The second is furi_assert, which doesn't compile in release mode
#ifdef NDEBUG
#define furi_check(__e) ((__e) ? (void)0 : __furi_check())
#ifdef NDEBUG
#define furi_assert(__e) ((void)0)
#else
#define furi_check(__e) \
((__e) ? (void)0 : __furi_check_debug(__FILE__, __LINE__, __FURI_CHECK_FUNC, #__e))
#define furi_assert(__e) \
((__e) ? (void)0 : __furi_check_debug(__FILE__, __LINE__, __FURI_CHECK_FUNC, #__e))
#define furi_assert(__e) ((__e) ? (void)0 : __furi_check())
#endif
// !NDEBUG

View File

@@ -33,7 +33,7 @@ void furi_record_init() {
}
FuriRecord* furi_record_get_or_create(string_t name_str) {
assert(furi_record_data);
furi_assert(furi_record_data);
FuriRecord* record = FuriRecordDict_get(furi_record_data->records, name_str);
if(!record) {
FuriRecord new_record;
@@ -47,7 +47,7 @@ FuriRecord* furi_record_get_or_create(string_t name_str) {
}
void furi_record_create(const char* name, void* data) {
assert(furi_record_data);
furi_assert(furi_record_data);
osThreadId_t thread_id = osThreadGetId();
string_t name_str;
@@ -71,7 +71,7 @@ void furi_record_create(const char* name, void* data) {
}
bool furi_record_destroy(const char* name) {
assert(furi_record_data);
furi_assert(furi_record_data);
osThreadId_t thread_id = osThreadGetId();
string_t name_str;
@@ -92,7 +92,7 @@ bool furi_record_destroy(const char* name) {
}
void* furi_record_open(const char* name) {
assert(furi_record_data);
furi_assert(furi_record_data);
osThreadId_t thread_id = osThreadGetId();
string_t name_str;
@@ -117,7 +117,7 @@ void* furi_record_open(const char* name) {
}
void furi_record_close(const char* name) {
assert(furi_record_data);
furi_assert(furi_record_data);
osThreadId_t thread_id = osThreadGetId();
string_t name_str;

View File

@@ -26,7 +26,7 @@ typedef struct {
static FuriStdglue* furi_stdglue = NULL;
static ssize_t stdout_write(void* _cookie, const char* data, size_t size) {
assert(furi_stdglue);
furi_assert(furi_stdglue);
osKernelState_t state = osKernelGetState();
osThreadId_t thread_id = osThreadGetId();
if(state == osKernelRunning && thread_id &&
@@ -88,7 +88,7 @@ void furi_stdglue_init() {
}
bool furi_stdglue_set_global_stdout_callback(FuriStdglueWriteCallback callback) {
assert(furi_stdglue);
furi_assert(furi_stdglue);
osThreadId_t thread_id = osThreadGetId();
if(thread_id) {
furi_check(osMutexAcquire(furi_stdglue->mutex, osWaitForever) == osOK);
@@ -106,7 +106,7 @@ bool furi_stdglue_set_global_stdout_callback(FuriStdglueWriteCallback callback)
}
bool furi_stdglue_set_thread_stdout_callback(FuriStdglueWriteCallback callback) {
assert(furi_stdglue);
furi_assert(furi_stdglue);
osThreadId_t thread_id = osThreadGetId();
if(thread_id) {
furi_check(osMutexAcquire(furi_stdglue->mutex, osWaitForever) == osOK);