BUILD: use inttypes.h instead of stdint.h

I found on an (old) AIX 5.1 machine that stdint.h didn't exist while
inttypes.h which is expected to include it does exist and provides the
desired functionalities.

As explained here, stdint being just a subset of inttypes for use in
freestanding environments, it's probably always OK to switch to inttypes
instead:

  https://pubs.opengroup.org/onlinepubs/009696799/basedefs/stdint.h.html

Also it's even clearer here in the autoconf doc :

  https://www.gnu.org/software/autoconf/manual/autoconf-2.61/html_node/Header-Portability.html

  "The C99 standard says that inttypes.h includes stdint.h, so there's
   no need to include stdint.h separately in a standard environment.
   Some implementations have inttypes.h but not stdint.h (e.g., Solaris
   7), but we don't know of any implementation that has stdint.h but not
   inttypes.h"
This commit is contained in:
Willy Tarreau 2019-03-29 17:26:33 +01:00
parent 7b5654f54a
commit a1bd1faeeb
27 changed files with 27 additions and 27 deletions

View File

@ -11,7 +11,7 @@
* -o decode decode.c
*/
#include <ctype.h>
#include <stdint.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

View File

@ -8,7 +8,7 @@
* gcc -I../../include -I../../ebtree -o gen-enc gen-enc.c
*/
#include <ctype.h>
#include <stdint.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

View File

@ -9,7 +9,7 @@
* 00 => 0x0a, 01 => 0x0d, 10 => 0x16, 11 => EOS
*/
#include <stdint.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -1,4 +1,4 @@
#include <stdint.h>
#include <inttypes.h>
#include <netlink/cache.h>
#include <netlink/cli/utils.h>
#include <netlink/cli/tc.h>

View File

@ -1,7 +1,7 @@
#ifndef _SPOP_FUNCTIONS_H
#define _SPOP_FUNCTIONS_H
#include <stdint.h>
#include <inttypes.h>
#include <string.h>
#include <spoe_types.h>

View File

@ -22,7 +22,7 @@
*/
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
#include <inttypes.h>
#include <arpa/inet.h>

View File

@ -28,7 +28,7 @@
#ifndef _COMMON_BUF_H
#define _COMMON_BUF_H
#include <stdint.h>
#include <inttypes.h>
#include <string.h>
#include <unistd.h>

View File

@ -22,7 +22,7 @@
#ifndef _COMMON_HASH_H_
#define _COMMON_HASH_H_
#include <stdint.h>
#include <inttypes.h>
unsigned int hash_djb2(const char *key, int len);
unsigned int hash_wt6(const char *key, int len);

View File

@ -28,7 +28,7 @@
#ifndef _COMMON_HPACK_DEC_H
#define _COMMON_HPACK_DEC_H
#include <stdint.h>
#include <inttypes.h>
#include <common/chunk.h>
#include <common/config.h>
#include <common/hpack-tbl.h>

View File

@ -28,7 +28,7 @@
#ifndef _COMMON_HPACK_ENC_H
#define _COMMON_HPACK_ENC_H
#include <stdint.h>
#include <inttypes.h>
#include <string.h>
#include <common/buf.h>
#include <common/config.h>

View File

@ -27,7 +27,7 @@
#ifndef _PROTO_HPACK_HUFF_H
#define _PROTO_HPACK_HUFF_H
#include <stdint.h>
#include <inttypes.h>
int huff_enc(const char *s, char *out);
int huff_dec(const uint8_t *huff, int hlen, char *out, int olen);

View File

@ -27,7 +27,7 @@
#ifndef _COMMON_HPACK_TBL_H
#define _COMMON_HPACK_TBL_H
#include <stdint.h>
#include <inttypes.h>
#include <stdlib.h>
#include <common/config.h>
#include <common/http-hdr.h>

View File

@ -27,7 +27,7 @@
#ifndef _COMMON_HTTP_HDR_H
#define _COMMON_HTTP_HDR_H
#include <stdint.h>
#include <inttypes.h>
#include <common/ist.h>
/* a header field made of a name and a value. Such structure stores 4 longs so

View File

@ -28,7 +28,7 @@
#ifndef _COMMON_ISTBUF_H
#define _COMMON_ISTBUF_H
#include <stdint.h>
#include <inttypes.h>
#include <common/buf.h>
#include <common/ist.h>

View File

@ -26,7 +26,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <inttypes.h>
#include <unistd.h>
#include <common/config.h>

View File

@ -22,7 +22,7 @@
#ifndef _COMMON_TIME_H
#define _COMMON_TIME_H
#include <stdint.h>
#include <inttypes.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/time.h>

View File

@ -22,7 +22,7 @@
#ifndef _PROTO_CHANNEL_H
#define _PROTO_CHANNEL_H
#include <stdint.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -22,7 +22,7 @@
#ifndef _PROTO_PROTOCOL_BUFFERS_H
#define _PROTO_PROTOCOL_BUFFERS_H
#include <stdint.h>
#include <inttypes.h>
#include <types/arg.h>
#include <types/protocol_buffers.h>
#include <proto/sample.h>

View File

@ -17,7 +17,7 @@
#include <common/mini-clist.h>
#include <types/shctx.h>
#include <stdint.h>
#include <inttypes.h>
#ifndef USE_PRIVATE_CACHE
#ifdef USE_PTHREAD_PSHARED

View File

@ -25,7 +25,7 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include <stdint.h>
#include <inttypes.h>
#include <common/config.h>
#include <common/h2.h>
#include <common/http-hdr.h>

View File

@ -25,7 +25,7 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include <stdint.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -25,7 +25,7 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include <stdint.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -26,7 +26,7 @@
*/
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
#include <string.h>
#include <common/config.h>

View File

@ -25,7 +25,7 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include <stdint.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -26,7 +26,7 @@
/* this is only to get definitions for memcpy(), ntohl() and htonl() */
#include <string.h>
#include <stdint.h>
#include <inttypes.h>
#include <arpa/inet.h>
#include <import/sha1.h>

View File

@ -10,7 +10,7 @@
*
*/
#include <stdint.h>
#include <inttypes.h>
#include <unistd.h>
#include <sys/time.h>

View File

@ -98,7 +98,7 @@ static void* XXH_memcpy(void* dest, const void* src, size_t size)
// Basic Types
//**************************************
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L // C99
# include <stdint.h>
# include <inttypes.h>
typedef uint8_t BYTE;
typedef uint16_t U16;
typedef uint32_t U32;