From 9654c3fd2e3b73215f44b3c8c9c6d249a0b24aef Mon Sep 17 00:00:00 2001 From: Jon Shallow Date: Sat, 25 Feb 2023 10:38:30 +0000 Subject: [PATCH] inttypes.h: Make usage for print formatting global --- include/coap3/coap_internal.h | 8 ++++++++ src/coap_gnutls.c | 1 - src/coap_mbedtls.c | 6 ------ src/coap_session.c | 6 ------ src/pdu.c | 6 ------ 5 files changed, 8 insertions(+), 19 deletions(-) diff --git a/include/coap3/coap_internal.h b/include/coap3/coap_internal.h index 2a5fb62b..7c519a17 100644 --- a/include/coap3/coap_internal.h +++ b/include/coap3/coap_internal.h @@ -35,6 +35,14 @@ # include #endif +#ifdef HAVE_INTTYPES_H +#include +#else /* ! HAVE_INTTYPES_H */ +#ifndef PRIx32 +#define PRIx32 "x" +#endif /* ! PRIx32 */ +#endif /* ! HAVE_INTTYPES_H */ + /* By default without either configured, these need to be set */ #ifndef COAP_SERVER_SUPPORT #ifndef COAP_CLIENT_SUPPORT diff --git a/src/coap_gnutls.c b/src/coap_gnutls.c index 6dd3ac7a..91307827 100644 --- a/src/coap_gnutls.c +++ b/src/coap_gnutls.c @@ -54,7 +54,6 @@ #define MIN_GNUTLS_VERSION "3.3.0" -#include #include #include #include diff --git a/src/coap_mbedtls.c b/src/coap_mbedtls.c index a399ca01..f1d6de3e 100644 --- a/src/coap_mbedtls.c +++ b/src/coap_mbedtls.c @@ -71,12 +71,6 @@ #endif /* ESPIDF_VERSION && CONFIG_MBEDTLS_DEBUG */ #include -#ifdef HAVE_INTTYPES_H -#include -#else /* ! HAVE_INTTYPES_H */ -#define PRIx32 "x" -#endif /* ! HAVE_INTTYPES_H */ - #define mbedtls_malloc(a) malloc(a) #define mbedtls_realloc(a,b) realloc(a,b) #define mbedtls_strdup(a) strdup(a) diff --git a/src/coap_session.c b/src/coap_session.c index 9fc2a262..891c9e7e 100644 --- a/src/coap_session.c +++ b/src/coap_session.c @@ -27,12 +27,6 @@ #endif /* COAP_EPOLL_SUPPORT */ #include -#ifdef HAVE_INTTYPES_H -#include -#else /* ! HAVE_INTTYPES_H */ -#define PRIu32 "u" -#endif /* ! HAVE_INTTYPES_H */ - void coap_session_set_ack_timeout(coap_session_t *session, coap_fixed_point_t value) { if (value.integer_part > 0 && value.fractional_part < 1000) { diff --git a/src/pdu.c b/src/pdu.c index 079d4531..523a6d55 100644 --- a/src/pdu.c +++ b/src/pdu.c @@ -30,12 +30,6 @@ #endif #include -#ifdef HAVE_INTTYPES_H -#include -#else /* ! HAVE_INTTYPES_H */ -#define PRIu32 "u" -#endif /* ! HAVE_INTTYPES_H */ - #ifndef min #define min(a,b) ((a) < (b) ? (a) : (b)) #endif