diff --git a/source/libs/monitorfw/inc/taos_assert.h b/source/libs/monitorfw/inc/taos_assert.h index 9fe05e910c..6c2583f3dc 100644 --- a/source/libs/monitorfw/inc/taos_assert.h +++ b/source/libs/monitorfw/inc/taos_assert.h @@ -23,9 +23,9 @@ #define TAOS_ASSERT(i) assert(i); #else #define TAOS_ASSERT(i) \ - if (i) return 1; + if (!(i)) return 1; #define TAOS_ASSERT_NULL(i) \ - if (i) return NULL; + if (!(i)) return NULL; #endif // TAOS_TEST #endif // TAOS_ASSERT_H diff --git a/source/libs/monitorfw/src/taos_linked_list.c b/source/libs/monitorfw/src/taos_linked_list.c index 01716a18be..625d5b0eab 100644 --- a/source/libs/monitorfw/src/taos_linked_list.c +++ b/source/libs/monitorfw/src/taos_linked_list.c @@ -35,7 +35,6 @@ taos_linked_list_t *taos_linked_list_new(void) { int taos_linked_list_purge(taos_linked_list_t *self) { TAOS_ASSERT(self != NULL); - if (self == NULL) return 1; taos_linked_list_node_t *node = self->head; while (node != NULL) { taos_linked_list_node_t *next = node->next; @@ -88,7 +87,6 @@ void *taos_linked_list_last(taos_linked_list_t *self) { int taos_linked_list_append(taos_linked_list_t *self, void *item) { TAOS_ASSERT(self != NULL); - if (self == NULL) return 1; taos_linked_list_node_t *node = (taos_linked_list_node_t *)taos_malloc(sizeof(taos_linked_list_node_t)); node->item = item; @@ -105,7 +103,6 @@ int taos_linked_list_append(taos_linked_list_t *self, void *item) { int taos_linked_list_push(taos_linked_list_t *self, void *item) { TAOS_ASSERT(self != NULL); - if (self == NULL) return 1; taos_linked_list_node_t *node = (taos_linked_list_node_t *)taos_malloc(sizeof(taos_linked_list_node_t)); node->item = item; @@ -147,7 +144,6 @@ void *taos_linked_list_pop(taos_linked_list_t *self) { int taos_linked_list_remove(taos_linked_list_t *self, void *item) { TAOS_ASSERT(self != NULL); - if (self == NULL) return 1; taos_linked_list_node_t *node; taos_linked_list_node_t *prev_node = NULL; #ifdef TAOS_LOG_ENABLE @@ -226,7 +222,6 @@ int taos_linked_list_remove(taos_linked_list_t *self, void *item) { taos_linked_list_compare_t taos_linked_list_compare(taos_linked_list_t *self, void *item_a, void *item_b) { TAOS_ASSERT(self != NULL); - if (self == NULL) return 1; if (self->compare_fn) { return (*self->compare_fn)(item_a, item_b); } else { @@ -241,14 +236,12 @@ size_t taos_linked_list_size(taos_linked_list_t *self) { int taos_linked_list_set_free_fn(taos_linked_list_t *self, taos_linked_list_free_item_fn free_fn) { TAOS_ASSERT(self != NULL); - if (self == NULL) return 1; self->free_fn = free_fn; return 0; } int taos_linked_list_set_compare_fn(taos_linked_list_t *self, taos_linked_list_compare_item_fn compare_fn) { TAOS_ASSERT(self != NULL); - if (self == NULL) return 1; self->compare_fn = compare_fn; return 0; }