From 0e17c5b523ea15899cf29c7c0a2305d066f37314 Mon Sep 17 00:00:00 2001 From: "Bruce A. Mah" Date: Fri, 23 Feb 2024 11:30:22 -0800 Subject: [PATCH] Assume we always have inttypes.h and stdint.h (both from C99). This eliminates some compile-time tests that didn't really work as desired and aren't easy to fix. Inspired by comments on PR #1636. --- examples/mic.c | 2 -- examples/mis.c | 2 -- src/cjson.c | 22 +--------------------- src/cjson.h | 2 -- src/iperf.h | 15 +-------------- src/iperf_api.c | 2 -- src/iperf_api.h | 2 -- src/iperf_locale.c | 12 +----------- src/iperf_server_api.c | 2 -- src/iperf_udp.c | 15 +-------------- src/main.c | 2 -- src/t_api.c | 2 -- src/t_auth.c | 2 -- src/t_timer.c | 2 -- src/t_units.c | 2 -- src/units.c | 2 -- 16 files changed, 4 insertions(+), 84 deletions(-) diff --git a/examples/mic.c b/examples/mic.c index 17fd7b2f9..6e2403f60 100644 --- a/examples/mic.c +++ b/examples/mic.c @@ -4,9 +4,7 @@ #include #include #include -#ifdef HAVE_STDINT_H #include -#endif #include diff --git a/examples/mis.c b/examples/mis.c index 8090c13d9..315b9e8ed 100644 --- a/examples/mis.c +++ b/examples/mis.c @@ -4,9 +4,7 @@ #include #include #include -#ifdef HAVE_STDINT_H #include -#endif #include diff --git a/src/cjson.c b/src/cjson.c index 02d8d6001..46495f4a6 100644 --- a/src/cjson.c +++ b/src/cjson.c @@ -45,9 +45,8 @@ #include #include #include -#ifdef HAVE_STDINT_H #include -#endif +#include #include #ifdef ENABLE_LOCALES @@ -90,25 +89,6 @@ #endif #endif -#if defined(HAVE_INTTYPES_H) -# include -#else -# ifndef PRIu64 -# if sizeof(long) == 8 -# define PRIu64 "lu" -# else -# define PRIu64 "llu" -# endif -# ifndef PRId64 -# if sizeof(long) == 8 -# define PRId64 "ld" -# else -# define PRId64 "lld" -# endif -# endif -# endif -#endif - typedef struct { const unsigned char *json; size_t position; diff --git a/src/cjson.h b/src/cjson.h index 52da40dc3..3aa83cba8 100644 --- a/src/cjson.h +++ b/src/cjson.h @@ -23,9 +23,7 @@ #ifndef cJSON__h #define cJSON__h -#ifdef HAVE_STDINT_H #include -#endif #ifdef __cplusplus extern "C" diff --git a/src/iperf.h b/src/iperf.h index a5eea4237..dc3c0d1df 100644 --- a/src/iperf.h +++ b/src/iperf.h @@ -31,9 +31,8 @@ #include #include -#ifdef HAVE_STDINT_H #include -#endif +#include #include #include #ifndef _GNU_SOURCE @@ -51,18 +50,6 @@ #include #endif /* HAVE_CPUSET_SETAFFINITY */ -#if defined(HAVE_INTTYPES_H) -# include -#else -# ifndef PRIu64 -# if sizeof(long) == 8 -# define PRIu64 "lu" -# else -# define PRIu64 "llu" -# endif -# endif -#endif - #include "timer.h" #include "queue.h" #include "cjson.h" diff --git a/src/iperf_api.c b/src/iperf_api.c index dd0abe814..1dcfaabf5 100644 --- a/src/iperf_api.c +++ b/src/iperf_api.c @@ -46,9 +46,7 @@ #include #include #include -#ifdef HAVE_STDINT_H #include -#endif #include #include #include diff --git a/src/iperf_api.h b/src/iperf_api.h index 20f7cc55a..d2bbdfe96 100644 --- a/src/iperf_api.h +++ b/src/iperf_api.h @@ -31,9 +31,7 @@ #include #include #include -#ifdef HAVE_STDINT_H #include -#endif #ifdef __cplusplus extern "C" { /* open extern "C" */ #endif diff --git a/src/iperf_locale.c b/src/iperf_locale.c index 41d78cb5c..ae0f63a41 100644 --- a/src/iperf_locale.c +++ b/src/iperf_locale.c @@ -81,17 +81,7 @@ #include "version.h" -#if defined(HAVE_INTTYPES_H) -# include -#else -# ifndef PRId64 -# if sizeof(long) == 8 -# define PRId64 "ld" -# else -# define PRId64 "lld" -# endif -# endif -#endif +#include #ifdef __cplusplus extern "C" diff --git a/src/iperf_server_api.c b/src/iperf_server_api.c index 77e9c355c..3bd20c62d 100644 --- a/src/iperf_server_api.c +++ b/src/iperf_server_api.c @@ -40,9 +40,7 @@ #include #include #include -#ifdef HAVE_STDINT_H #include -#endif #include #include #include diff --git a/src/iperf_udp.c b/src/iperf_udp.c index 5f69ee366..a603236df 100644 --- a/src/iperf_udp.c +++ b/src/iperf_udp.c @@ -34,9 +34,8 @@ #include #include #include -#ifdef HAVE_STDINT_H #include -#endif +#include #include #include @@ -48,18 +47,6 @@ #include "net.h" #include "cjson.h" -#if defined(HAVE_INTTYPES_H) -# include -#else -# ifndef PRIu64 -# if sizeof(long) == 8 -# define PRIu64 "lu" -# else -# define PRIu64 "llu" -# endif -# endif -#endif - /* iperf_udp_recv * * receives the data for UDP diff --git a/src/main.c b/src/main.c index b179f5bde..57d5f40e0 100644 --- a/src/main.c +++ b/src/main.c @@ -33,9 +33,7 @@ #include #include #include -#ifdef HAVE_STDINT_H #include -#endif #include #include #include diff --git a/src/t_api.c b/src/t_api.c index d822f559e..d3bfb7e20 100644 --- a/src/t_api.c +++ b/src/t_api.c @@ -27,9 +27,7 @@ #include -#ifdef HAVE_STDINT_H #include -#endif #include #include diff --git a/src/t_auth.c b/src/t_auth.c index 22c78ae1f..77c225531 100644 --- a/src/t_auth.c +++ b/src/t_auth.c @@ -27,9 +27,7 @@ #include "iperf_config.h" #include -#ifdef HAVE_STDINT_H #include -#endif #include #include diff --git a/src/t_timer.c b/src/t_timer.c index 8eec7d8f3..fb6eb19b7 100644 --- a/src/t_timer.c +++ b/src/t_timer.c @@ -26,9 +26,7 @@ */ #include "iperf_config.h" -#ifdef HAVE_STDINT_H #include -#endif #include #include #include diff --git a/src/t_units.c b/src/t_units.c index 73f21a9d8..13883aa54 100644 --- a/src/t_units.c +++ b/src/t_units.c @@ -25,9 +25,7 @@ * file for complete information. */ #include -#ifdef HAVE_STDINT_H #include -#endif #include #include diff --git a/src/units.c b/src/units.c index 7376a0b7f..f6b14bc5d 100644 --- a/src/units.c +++ b/src/units.c @@ -54,9 +54,7 @@ #include #include #include -#ifdef HAVE_STDINT_H #include -#endif #include #include #include