From eb6f701b99cd5a6578fbfa3496d5b65f06d284dc Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 27 May 2020 16:21:26 +0200 Subject: [PATCH] REORG: include: move ist.h from common/ to import/ Fortunately that file wasn't made dependent upon haproxy since it was integrated, better isolate it before it's too late. Its dependency on api.h was the result of the change from config.h, which in turn wasn't correct. It was changed back to stddef.h for size_t and sys/types.h for ssize_t. The recently added reference to MAX() was changed as it was placed only to avoid a zero length in the non-free-standing version and was causing a build warning in the hpack encoder. --- contrib/hpack/gen-enc.c | 2 +- include/common/buffer.h | 2 +- include/common/chunk.h | 2 +- include/common/fcgi.h | 2 +- include/common/h1.h | 2 +- include/common/h2.h | 2 +- include/common/hpack-enc.h | 2 +- include/common/hpack-tbl.h | 2 +- include/common/http-hdr.h | 2 +- include/common/http.h | 2 +- include/common/htx.h | 2 +- include/common/istbuf.h | 2 +- include/{common => import}/ist.h | 17 ++++++++--------- include/proto/connection.h | 2 +- include/proto/h1_htx.h | 2 +- include/proto/http_htx.h | 2 +- include/proto/ring.h | 2 +- include/proto/trace.h | 2 +- include/types/checks.h | 2 +- include/types/connection.h | 2 +- include/types/fcgi-app.h | 2 +- include/types/fd.h | 2 +- include/types/http_htx.h | 2 +- include/types/ring.h | 2 +- include/types/sink.h | 2 +- include/types/trace.h | 2 +- src/debug.c | 2 +- src/h2.c | 2 +- src/hpack-dec.c | 2 +- src/hpack-enc.c | 2 +- src/hpack-tbl.c | 2 +- src/mux_fcgi.c | 2 +- src/sink.c | 2 +- src/trace.c | 2 +- 34 files changed, 41 insertions(+), 42 deletions(-) rename include/{common => import}/ist.h (99%) diff --git a/contrib/hpack/gen-enc.c b/contrib/hpack/gen-enc.c index dfe47055e..36b132bd7 100644 --- a/contrib/hpack/gen-enc.c +++ b/contrib/hpack/gen-enc.c @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include "../../src/hpack-tbl.c" diff --git a/include/common/buffer.h b/include/common/buffer.h index f7aa2542f..d90b94e8b 100644 --- a/include/common/buffer.h +++ b/include/common/buffer.h @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include diff --git a/include/common/chunk.h b/include/common/chunk.h index ae7ae8538..d4f9ea23a 100644 --- a/include/common/chunk.h +++ b/include/common/chunk.h @@ -27,7 +27,7 @@ #include #include -#include +#include #include diff --git a/include/common/fcgi.h b/include/common/fcgi.h index b9a752b92..6d3c6eb19 100644 --- a/include/common/fcgi.h +++ b/include/common/fcgi.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include /* FCGI protocol version */ #define FCGI_VERSION 0x1 diff --git a/include/common/h1.h b/include/common/h1.h index 0bc0f4864..f75ee11fb 100644 --- a/include/common/h1.h +++ b/include/common/h1.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include diff --git a/include/common/h2.h b/include/common/h2.h index 5654a7611..32f02060a 100644 --- a/include/common/h2.h +++ b/include/common/h2.h @@ -32,7 +32,7 @@ #include #include #include -#include +#include /* indexes of most important pseudo headers can be simplified to an almost diff --git a/include/common/hpack-enc.h b/include/common/hpack-enc.h index f204853d7..f766063ff 100644 --- a/include/common/hpack-enc.h +++ b/include/common/hpack-enc.h @@ -32,7 +32,7 @@ #include #include #include -#include +#include int hpack_encode_header(struct buffer *out, const struct ist n, const struct ist v); diff --git a/include/common/hpack-tbl.h b/include/common/hpack-tbl.h index cde7114af..1d2a8bd5f 100644 --- a/include/common/hpack-tbl.h +++ b/include/common/hpack-tbl.h @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include /* Dynamic Headers Table, usable for tables up to 4GB long and values of 64kB-1. diff --git a/include/common/http-hdr.h b/include/common/http-hdr.h index ffca828d2..77997e33e 100644 --- a/include/common/http-hdr.h +++ b/include/common/http-hdr.h @@ -28,7 +28,7 @@ #define _COMMON_HTTP_HDR_H #include -#include +#include /* a header field made of a name and a value. Such structure stores 4 longs so * it takes 16 bytes on 32-bit systems and 32 bytes on 64-bit systems. diff --git a/include/common/http.h b/include/common/http.h index acf19903f..86cf01536 100644 --- a/include/common/http.h +++ b/include/common/http.h @@ -24,7 +24,7 @@ #define _COMMON_HTTP_H #include -#include +#include /* * some macros mainly used when parsing header fields. diff --git a/include/common/htx.h b/include/common/htx.h index 5a13614f3..1a87cde75 100644 --- a/include/common/htx.h +++ b/include/common/htx.h @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/include/common/istbuf.h b/include/common/istbuf.h index a533c7174..f9bf0b1f9 100644 --- a/include/common/istbuf.h +++ b/include/common/istbuf.h @@ -30,7 +30,7 @@ #include #include -#include +#include /* b_isteq() : returns > 0 if the first characters of buffer starting diff --git a/include/common/ist.h b/include/import/ist.h similarity index 99% rename from include/common/ist.h rename to include/import/ist.h index d62924e16..08e211938 100644 --- a/include/common/ist.h +++ b/include/import/ist.h @@ -1,8 +1,8 @@ /* - * include/common/ist.h + * include/import/ist.h * Very simple indirect string manipulation functions. * - * Copyright (C) 2014-2017 Willy Tarreau - w@1wt.eu + * Copyright (C) 2014-2020 Willy Tarreau - w@1wt.eu * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -25,19 +25,18 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef _COMMON_IST_H -#define _COMMON_IST_H +#ifndef _IMPORT_IST_H +#define _IMPORT_IST_H +#include #include +#include #include -#include #ifndef IST_FREESTANDING #include #endif -#include - /* ASCII to lower case conversion table */ #define _IST_LC ((const unsigned char[256]){ \ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, \ @@ -658,7 +657,7 @@ static inline const char *ist_find_ctl(const struct ist ist) last += sizeof(long); if (__builtin_expect(curr < last, 0)) { do { - if ((uint8_t)*curr < 0x20) + if ((unsigned char)*curr < 0x20) return curr; curr++; } while (curr < last); @@ -794,7 +793,7 @@ static inline struct ist istdup(const struct ist src) /* Allocate at least 1 byte to allow duplicating an empty string with * malloc implementations that return NULL for a 0-size allocation. */ - struct ist dst = istalloc(MAX(src_size, 1)); + struct ist dst = istalloc(src_size ? src_size : 1); if (isttest(dst)) { istcpy(&dst, src, src_size); diff --git a/include/proto/connection.h b/include/proto/connection.h index 9b1e3d871..2efd629fc 100644 --- a/include/proto/connection.h +++ b/include/proto/connection.h @@ -23,7 +23,7 @@ #define _PROTO_CONNECTION_H #include -#include +#include #include #include #include diff --git a/include/proto/h1_htx.h b/include/proto/h1_htx.h index a8fd88675..13ba394d5 100644 --- a/include/proto/h1_htx.h +++ b/include/proto/h1_htx.h @@ -24,7 +24,7 @@ #define _PROTO_H1_HTX_H #include -#include +#include #include int h1_parse_msg_hdrs(struct h1m *h1m, union h1_sl *h1sl, struct htx *dsthtx, diff --git a/include/proto/http_htx.h b/include/proto/http_htx.h index 557d34f45..edbd8f1bf 100644 --- a/include/proto/http_htx.h +++ b/include/proto/http_htx.h @@ -24,7 +24,7 @@ #define _PROTO_HTTP_HTX_H #include -#include +#include #include #include diff --git a/include/proto/ring.h b/include/proto/ring.h index 8adbb9c52..6f393fe43 100644 --- a/include/proto/ring.h +++ b/include/proto/ring.h @@ -23,7 +23,7 @@ #define _PROTO_RING_H #include -#include +#include #include struct ring *ring_new(size_t size); diff --git a/include/proto/trace.h b/include/proto/trace.h index ef88079b1..f43faf5a9 100644 --- a/include/proto/trace.h +++ b/include/proto/trace.h @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include #include diff --git a/include/types/checks.h b/include/types/checks.h index b2be640c3..4b8177078 100644 --- a/include/types/checks.h +++ b/include/types/checks.h @@ -17,7 +17,7 @@ #include #include -#include +#include #include #include #include diff --git a/include/types/connection.h b/include/types/connection.h index 7357174dc..601e5056c 100644 --- a/include/types/connection.h +++ b/include/types/connection.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include diff --git a/include/types/fcgi-app.h b/include/types/fcgi-app.h index f0fcdc7ae..7fb20ee6f 100644 --- a/include/types/fcgi-app.h +++ b/include/types/fcgi-app.h @@ -23,7 +23,7 @@ #define _TYPES_HTTP_FCGI_H #include -#include +#include #include #include #include diff --git a/include/types/fd.h b/include/types/fd.h index 0041d4d60..7ec97bc74 100644 --- a/include/types/fd.h +++ b/include/types/fd.h @@ -24,7 +24,7 @@ #include #include -#include +#include #include /* Direction for each FD event update */ diff --git a/include/types/http_htx.h b/include/types/http_htx.h index 301034c8f..02b6b3b48 100644 --- a/include/types/http_htx.h +++ b/include/types/http_htx.h @@ -28,7 +28,7 @@ #include #include #include -#include +#include /* Context used to find/remove an HTTP header. */ struct http_hdr_ctx { diff --git a/include/types/ring.h b/include/types/ring.h index ac93c1219..f3b3987a8 100644 --- a/include/types/ring.h +++ b/include/types/ring.h @@ -24,7 +24,7 @@ #include #include -#include +#include /* The code below handles circular buffers with single-producer and multiple * readers (up to 255). The buffer storage area must remain always allocated. diff --git a/include/types/sink.h b/include/types/sink.h index 64b0bcaf4..b10cb8912 100644 --- a/include/types/sink.h +++ b/include/types/sink.h @@ -24,7 +24,7 @@ #include #include -#include +#include /* A sink may be of 4 distinct types : * - file descriptor (such as stdout) diff --git a/include/types/trace.h b/include/types/trace.h index cd5e8be15..ad9d7b6a0 100644 --- a/include/types/trace.h +++ b/include/types/trace.h @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include diff --git a/src/debug.c b/src/debug.c index 7f281f029..e1b9070bf 100644 --- a/src/debug.c +++ b/src/debug.c @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/h2.c b/src/h2.c index 891c3e06c..c94ea8e03 100644 --- a/src/h2.c +++ b/src/h2.c @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include struct h2_frame_definition h2_frame_definition[H2_FT_ENTRIES] = { diff --git a/src/hpack-dec.c b/src/hpack-dec.c index fa25ac475..50293d850 100644 --- a/src/hpack-dec.c +++ b/src/hpack-dec.c @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include diff --git a/src/hpack-enc.c b/src/hpack-enc.c index 1a6fa1cc8..bf7336b08 100644 --- a/src/hpack-enc.c +++ b/src/hpack-enc.c @@ -32,7 +32,7 @@ #include #include -#include +#include #include diff --git a/src/hpack-tbl.c b/src/hpack-tbl.c index effe5e01e..31c24b21f 100644 --- a/src/hpack-tbl.c +++ b/src/hpack-tbl.c @@ -32,7 +32,7 @@ #include #include -#include +#include #include diff --git a/src/mux_fcgi.c b/src/mux_fcgi.c index 5ce6f6191..7ff39328c 100644 --- a/src/mux_fcgi.c +++ b/src/mux_fcgi.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/sink.c b/src/sink.c index 20d3d79b1..7eb283fc6 100644 --- a/src/sink.c +++ b/src/sink.c @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/trace.c b/src/trace.c index 667cd81ca..3f6ff0543 100644 --- a/src/trace.c +++ b/src/trace.c @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include #include