From d82e31f9039b573690ff41888f1f5f4de11b1900 Mon Sep 17 00:00:00 2001 From: Krzysztof Chruscinski Date: Thu, 11 Mar 2021 15:19:52 +0100 Subject: [PATCH] lib: os: cbprintf: Fix Z_C_GENERIC not being used Due to the fact that define was created after including cbprintf_internal.h, it was not used there. Change the order and fix the issue that was revealed. Signed-off-by: Krzysztof Chruscinski --- include/sys/cbprintf.h | 4 +++- include/sys/cbprintf_internal.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/sys/cbprintf.h b/include/sys/cbprintf.h index 51700bca37a..0c56267bcd9 100644 --- a/include/sys/cbprintf.h +++ b/include/sys/cbprintf.h @@ -11,7 +11,6 @@ #include #include #include -#include #ifdef CONFIG_CBPRINTF_LIBC_SUBSTS #include @@ -36,6 +35,9 @@ extern "C" { #endif #endif +/* Z_C_GENERIC is used there */ +#include + /** * @defgroup cbprintf_apis Formatted Output APIs * @ingroup support_apis diff --git a/include/sys/cbprintf_internal.h b/include/sys/cbprintf_internal.h index 75cb8d9f3a7..c5de3137de7 100644 --- a/include/sys/cbprintf_internal.h +++ b/include/sys/cbprintf_internal.h @@ -242,7 +242,7 @@ do { \ "Buffer must be aligned."); \ } \ uint8_t *_pbuf = buf; \ - size_t _pmax = (buf != NULL) ? *_inlen : SIZE_MAX; \ + size_t _pmax = (buf != NULL) ? _inlen : SIZE_MAX; \ size_t _pkg_len = 0; \ union z_cbprintf_hdr *_len_loc; \ /* package starts with string address and field with length */ \