Skip to content

Commit c362e1a

Browse files
committed
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.
1 parent e004dc3 commit c362e1a

File tree

16 files changed

+4
-84
lines changed

16 files changed

+4
-84
lines changed

examples/mic.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
#include <stdlib.h>
55
#include <unistd.h>
66
#include <string.h>
7-
#ifdef HAVE_STDINT_H
87
#include <stdint.h>
9-
#endif
108

119
#include <iperf_api.h>
1210

examples/mis.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
#include <stdlib.h>
55
#include <unistd.h>
66
#include <string.h>
7-
#ifdef HAVE_STDINT_H
87
#include <stdint.h>
9-
#endif
108

119
#include <iperf_api.h>
1210

src/cjson.c

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@
4545
#include <limits.h>
4646
#include <ctype.h>
4747
#include <float.h>
48-
#ifdef HAVE_STDINT_H
4948
#include <stdint.h>
50-
#endif
49+
#include <inttypes.h>
5150
#include <sys/types.h>
5251

5352
#ifdef ENABLE_LOCALES
@@ -90,25 +89,6 @@
9089
#endif
9190
#endif
9291

93-
#if defined(HAVE_INTTYPES_H)
94-
# include <inttypes.h>
95-
#else
96-
# ifndef PRIu64
97-
# if sizeof(long) == 8
98-
# define PRIu64 "lu"
99-
# else
100-
# define PRIu64 "llu"
101-
# endif
102-
# ifndef PRId64
103-
# if sizeof(long) == 8
104-
# define PRId64 "ld"
105-
# else
106-
# define PRId64 "lld"
107-
# endif
108-
# endif
109-
# endif
110-
#endif
111-
11292
typedef struct {
11393
const unsigned char *json;
11494
size_t position;

src/cjson.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@
2323
#ifndef cJSON__h
2424
#define cJSON__h
2525

26-
#ifdef HAVE_STDINT_H
2726
#include <stdint.h>
28-
#endif
2927

3028
#ifdef __cplusplus
3129
extern "C"

src/iperf.h

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@
3131

3232
#include <sys/time.h>
3333
#include <sys/types.h>
34-
#ifdef HAVE_STDINT_H
3534
#include <stdint.h>
36-
#endif
35+
#include <inttypes.h>
3736
#include <sys/select.h>
3837
#include <sys/socket.h>
3938
#ifndef _GNU_SOURCE
@@ -51,18 +50,6 @@
5150
#include <sys/cpuset.h>
5251
#endif /* HAVE_CPUSET_SETAFFINITY */
5352

54-
#if defined(HAVE_INTTYPES_H)
55-
# include <inttypes.h>
56-
#else
57-
# ifndef PRIu64
58-
# if sizeof(long) == 8
59-
# define PRIu64 "lu"
60-
# else
61-
# define PRIu64 "llu"
62-
# endif
63-
# endif
64-
#endif
65-
6653
#include "timer.h"
6754
#include "queue.h"
6855
#include "cjson.h"

src/iperf_api.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@
4646
#include <netinet/in.h>
4747
#include <arpa/inet.h>
4848
#include <netdb.h>
49-
#ifdef HAVE_STDINT_H
5049
#include <stdint.h>
51-
#endif
5250
#include <sys/time.h>
5351
#include <sys/resource.h>
5452
#include <sys/mman.h>

src/iperf_api.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@
3131
#include <sys/time.h>
3232
#include <setjmp.h>
3333
#include <stdio.h>
34-
#ifdef HAVE_STDINT_H
3534
#include <stdint.h>
36-
#endif
3735
#ifdef __cplusplus
3836
extern "C" { /* open extern "C" */
3937
#endif

src/iperf_locale.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,7 @@
8181

8282
#include "version.h"
8383

84-
#if defined(HAVE_INTTYPES_H)
85-
# include <inttypes.h>
86-
#else
87-
# ifndef PRId64
88-
# if sizeof(long) == 8
89-
# define PRId64 "ld"
90-
# else
91-
# define PRId64 "lld"
92-
# endif
93-
# endif
94-
#endif
84+
#include <inttypes.h>
9585

9686
#ifdef __cplusplus
9787
extern "C"

src/iperf_server_api.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@
4040
#include <netinet/in.h>
4141
#include <arpa/inet.h>
4242
#include <netdb.h>
43-
#ifdef HAVE_STDINT_H
4443
#include <stdint.h>
45-
#endif
4644
#include <sys/time.h>
4745
#include <sys/resource.h>
4846
#include <sched.h>

src/iperf_udp.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@
3434
#include <sys/socket.h>
3535
#include <sys/types.h>
3636
#include <netinet/in.h>
37-
#ifdef HAVE_STDINT_H
3837
#include <stdint.h>
39-
#endif
38+
#include <inttypes.h>
4039
#include <sys/time.h>
4140
#include <sys/select.h>
4241

@@ -48,18 +47,6 @@
4847
#include "net.h"
4948
#include "cjson.h"
5049

51-
#if defined(HAVE_INTTYPES_H)
52-
# include <inttypes.h>
53-
#else
54-
# ifndef PRIu64
55-
# if sizeof(long) == 8
56-
# define PRIu64 "lu"
57-
# else
58-
# define PRIu64 "llu"
59-
# endif
60-
# endif
61-
#endif
62-
6350
/* iperf_udp_recv
6451
*
6552
* receives the data for UDP

0 commit comments

Comments
 (0)