CLEANUP: tree-wide: use VAR_ARRAY instead of [0] in various definitions

Surprisingly there were still a number of [0] definitions for variable
sized arrays in certain structures all over the code. We need to use
VAR_ARRAY instead of zero to accommodate various compilers' preferences,
as zero was used only on old ones and tends to report errors on new ones.
This commit is contained in:
Willy Tarreau 2020-09-12 20:56:41 +02:00
parent e52b6e5456
commit 4987a47446
8 changed files with 11 additions and 11 deletions

View File

@ -589,14 +589,14 @@ struct tlv {
uint8_t type;
uint8_t length_hi;
uint8_t length_lo;
uint8_t value[0];
uint8_t value[VAR_ARRAY];
}__attribute__((packed));
struct tlv_ssl {
struct tlv tlv;
uint8_t client;
uint32_t verify;
uint8_t sub_tlv[0];
uint8_t sub_tlv[VAR_ARRAY];
}__attribute__((packed));

View File

@ -102,7 +102,7 @@ struct hpack_dht {
uint16_t wrap; /* number of allocated slots, wraps here */
uint16_t head; /* last inserted slot number */
uint16_t used; /* number of slots in use */
struct hpack_dte dte[0]; /* dynamic table entries */
struct hpack_dte dte[VAR_ARRAY]; /* dynamic table entries */
};
/* supported hpack encoding/decoding errors */

View File

@ -194,7 +194,7 @@ struct htx_sl {
* corresponding EOH. -1 if unknown */
unsigned int len[3]; /* length of different parts of the start-line */
char l[0];
char l[VAR_ARRAY];
};
/* Internal representation of an HTTP message */
@ -218,7 +218,7 @@ struct htx {
/* XXX 4 bytes unused */
/* Blocks representing the HTTP message itself */
char blocks[0] __attribute__((aligned(8)));
char blocks[VAR_ARRAY] __attribute__((aligned(8)));
};
#endif /* _HAPROXY_HTX_T_H */

View File

@ -27,7 +27,7 @@
struct port_range {
int size, get, put_h, put_t; /* range size, and get/put positions */
uint16_t ports[0]; /* array of <size> ports, in host byte order */
uint16_t ports[VAR_ARRAY]; /* array of <size> ports, in host byte order */
};
#endif /* _HAPROXY_PORT_RANGE_T_H */

View File

@ -249,7 +249,7 @@ struct error_snapshot {
/**** protocol-specific part ****/
union error_snapshot_ctx ctx;
char buf[0]; /* copy of the beginning of the message for bufsize bytes */
char buf[VAR_ARRAY]; /* copy of the beginning of the message for bufsize bytes */
};
struct proxy {

View File

@ -44,7 +44,7 @@ struct shared_block {
unsigned int refcount;
struct shared_block *last_reserved;
struct shared_block *last_append;
unsigned char data[0];
unsigned char data[VAR_ARRAY];
};
struct shared_context {
@ -61,7 +61,7 @@ struct shared_context {
unsigned int max_obj_size; /* maximum object size (in bytes). */
void (*free_block)(struct shared_block *first, struct shared_block *block);
short int block_size;
unsigned char data[0];
unsigned char data[VAR_ARRAY];
};
#endif /* __HAPROXY_SHCTX_T_H */

View File

@ -69,7 +69,7 @@ struct ckch_store {
struct list ckch_inst; /* list of ckch_inst which uses this ckch_node */
struct list crtlist_entry; /* list of entries which use this store */
struct ebmb_node node;
char path[0];
char path[VAR_ARRAY];
};
/* forward declarations for ckch_inst */

View File

@ -223,7 +223,7 @@ struct ssl_sock_msg_callback {
struct ssl_capture {
unsigned long long int xxh64;
unsigned char ciphersuite_len;
char ciphersuite[0];
char ciphersuite[VAR_ARRAY];
};
#if (HA_OPENSSL_VERSION_NUMBER >= 0x10101000L)