Skip to content

Commit 2a26a3a

Browse files
committed
net: http: server: Avoid compiler warnings for zero-length-arrays
Avoid compiler warnings for zero-length-arrays in the http-server. Signed-off-by: Cla Mattia Galliard <[email protected]>
1 parent ca0f5f6 commit 2a26a3a

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

include/zephyr/net/http/server.h

+7-10
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,6 @@ extern "C" {
4949
#define HTTP_SERVER_MAX_HEADER_LEN 0
5050
#endif
5151

52-
#if defined(CONFIG_HTTP_SERVER_CAPTURE_HEADERS)
53-
#define HTTP_SERVER_CAPTURE_HEADER_BUFFER_SIZE CONFIG_HTTP_SERVER_CAPTURE_HEADER_BUFFER_SIZE
54-
#define HTTP_SERVER_CAPTURE_HEADER_COUNT CONFIG_HTTP_SERVER_CAPTURE_HEADER_COUNT
55-
#else
56-
#define HTTP_SERVER_CAPTURE_HEADER_BUFFER_SIZE 0
57-
#define HTTP_SERVER_CAPTURE_HEADER_COUNT 0
58-
#endif
59-
6052
#define HTTP2_PREFACE "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"
6153

6254
/** @endcond */
@@ -375,11 +367,16 @@ struct http2_frame {
375367
/** @cond INTERNAL_HIDDEN */
376368
/** @brief Context for capturing HTTP headers */
377369
struct http_header_capture_ctx {
370+
371+
#if defined(CONFIG_HTTP_SERVER_CAPTURE_HEADERS)
378372
/** Buffer for HTTP headers captured for application use */
379-
unsigned char buffer[HTTP_SERVER_CAPTURE_HEADER_BUFFER_SIZE];
373+
unsigned char buffer[CONFIG_HTTP_SERVER_CAPTURE_HEADER_BUFFER_SIZE];
374+
#endif
380375

376+
#if defined(CONFIG_HTTP_SERVER_CAPTURE_HEADERS)
381377
/** Descriptor of each captured HTTP header */
382-
struct http_header headers[HTTP_SERVER_CAPTURE_HEADER_COUNT];
378+
struct http_header headers[CONFIG_HTTP_SERVER_CAPTURE_HEADER_COUNT];
379+
#endif
383380

384381
/** Status of captured headers */
385382
enum http_header_status status;

0 commit comments

Comments
 (0)