From aabd8e7fa06557959565fc79c380cb190c2eed38 Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Tue, 4 Dec 2018 12:15:28 -0800 Subject: [PATCH] logging: Simplify function to get number of log backends As we subtracting pointers of the same type, it is not necessary cast it to u8_t. This simplify and avoid some MISRA-C violations, e.g rule 11.8. Signed-off-by: Flavio Ceolin --- include/logging/log_backend.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/logging/log_backend.h b/include/logging/log_backend.h index 3ecfd0b4919..37e6251e242 100644 --- a/include/logging/log_backend.h +++ b/include/logging/log_backend.h @@ -171,8 +171,7 @@ static inline const struct log_backend *log_backend_get(u32_t idx) */ static inline int log_backend_count_get(void) { - return ((u8_t *)__log_backends_end - (u8_t *)__log_backends_start) / - sizeof(struct log_backend); + return __log_backends_end - __log_backends_start; } /**