Skip to content

Commit

Permalink
Assume we always have inttypes.h and stdint.h (both from C99).
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bmah888 committed Feb 23, 2024
1 parent e004dc3 commit 0e17c5b
Show file tree
Hide file tree
Showing 16 changed files with 4 additions and 84 deletions.
2 changes: 0 additions & 2 deletions examples/mic.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif

#include <iperf_api.h>

Expand Down
2 changes: 0 additions & 2 deletions examples/mis.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif

#include <iperf_api.h>

Expand Down
22 changes: 1 addition & 21 deletions src/cjson.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@
#include <limits.h>
#include <ctype.h>
#include <float.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#include <inttypes.h>
#include <sys/types.h>

#ifdef ENABLE_LOCALES
Expand Down Expand Up @@ -90,25 +89,6 @@
#endif
#endif

#if defined(HAVE_INTTYPES_H)
# include <inttypes.h>
#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;
Expand Down
2 changes: 0 additions & 2 deletions src/cjson.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
#ifndef cJSON__h
#define cJSON__h

#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif

#ifdef __cplusplus
extern "C"
Expand Down
15 changes: 1 addition & 14 deletions src/iperf.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@

#include <sys/time.h>
#include <sys/types.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#include <inttypes.h>
#include <sys/select.h>
#include <sys/socket.h>
#ifndef _GNU_SOURCE
Expand All @@ -51,18 +50,6 @@
#include <sys/cpuset.h>
#endif /* HAVE_CPUSET_SETAFFINITY */

#if defined(HAVE_INTTYPES_H)
# include <inttypes.h>
#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"
Expand Down
2 changes: 0 additions & 2 deletions src/iperf_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/mman.h>
Expand Down
2 changes: 0 additions & 2 deletions src/iperf_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@
#include <sys/time.h>
#include <setjmp.h>
#include <stdio.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#ifdef __cplusplus
extern "C" { /* open extern "C" */
#endif
Expand Down
12 changes: 1 addition & 11 deletions src/iperf_locale.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,7 @@

#include "version.h"

#if defined(HAVE_INTTYPES_H)
# include <inttypes.h>
#else
# ifndef PRId64
# if sizeof(long) == 8
# define PRId64 "ld"
# else
# define PRId64 "lld"
# endif
# endif
#endif
#include <inttypes.h>

#ifdef __cplusplus
extern "C"
Expand Down
2 changes: 0 additions & 2 deletions src/iperf_server_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#include <sys/time.h>
#include <sys/resource.h>
#include <sched.h>
Expand Down
15 changes: 1 addition & 14 deletions src/iperf_udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#include <inttypes.h>
#include <sys/time.h>
#include <sys/select.h>

Expand All @@ -48,18 +47,6 @@
#include "net.h"
#include "cjson.h"

#if defined(HAVE_INTTYPES_H)
# include <inttypes.h>
#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
Expand Down
2 changes: 0 additions & 2 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@
#include <errno.h>
#include <signal.h>
#include <unistd.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
Expand Down
2 changes: 0 additions & 2 deletions src/t_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@


#include <assert.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#include <stdio.h>
#include <string.h>

Expand Down
2 changes: 0 additions & 2 deletions src/t_auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@
#include "iperf_config.h"

#include <assert.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#include <stdio.h>
#include <string.h>

Expand Down
2 changes: 0 additions & 2 deletions src/t_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
*/
#include "iperf_config.h"

#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
Expand Down
2 changes: 0 additions & 2 deletions src/t_units.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
* file for complete information.
*/
#include <assert.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#include <stdio.h>
#include <string.h>

Expand Down
2 changes: 0 additions & 2 deletions src/units.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@
#include <stdio.h>
#include <assert.h>
#include <ctype.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/time.h>
Expand Down

0 comments on commit 0e17c5b

Please sign in to comment.