From: Willy Tarreau Date: Wed, 27 May 2020 14:21:26 +0000 (+0200) Subject: REORG: include: move ist.h from common/ to import/ X-Git-Tag: v2.2-dev9~131 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eb6f701b99cd5a6578fbfa3496d5b65f06d284dc;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/contrib/hpack/gen-enc.c b/contrib/hpack/gen-enc.c index dfe47055e0..36b132bd70 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 f7aa2542f9..d90b94e8be 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 ae7ae85384..d4f9ea23a9 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 b9a752b92c..6d3c6eb19b 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 0bc0f4864b..f75ee11fbd 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 5654a76111..32f02060ae 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 f204853d73..f766063ff7 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 cde7114af8..1d2a8bd5f1 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 ffca828d22..77997e33e1 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 acf19903fb..86cf01536c 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 5a13614f34..1a87cde75b 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 a533c71749..f9bf0b1f90 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 d62924e167..08e2119382 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 9b1e3d871c..2efd629fca 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 a8fd886751..13ba394d54 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 557d34f457..edbd8f1bf3 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 8adbb9c520..6f393fe43e 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 ef88079b18..f43faf5a9a 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 b2be640c3c..4b81770787 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 7357174dcb..601e5056c5 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 f0fcdc7aec..7fb20ee6f7 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 0041d4d601..7ec97bc741 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 301034c8f5..02b6b3b482 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 ac93c12196..f3b3987a83 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 64b0bcaf4d..b10cb89123 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 cd5e8be152..ad9d7b6a02 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 7f281f0294..e1b9070bfd 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 891c3e06cd..c94ea8e034 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 fa25ac4753..50293d8505 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 1a6fa1cc89..bf7336b08f 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 effe5e01e0..31c24b21f5 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 5ce6f6191e..7ff39328c7 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 20d3d79b16..7eb283fc67 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 667cd81cac..3f6ff0543d 100644 --- a/src/trace.c +++ b/src/trace.c @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include #include