Skip to content
This repository was archived by the owner on Nov 6, 2022. It is now read-only.

Split marco 'HTTP_ERRNO_MAP' #533

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions http_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,8 @@ enum flags
, F_CONTENTLENGTH = 1 << 7
};


/* Map for errno-related constants
*
* The provided argument should be a macro that takes 2 arguments.
*/
#define HTTP_ERRNO_MAP(XX) \
/* No error */ \
XX(OK, "success") \
\
/* Map for callback error related constans */
#define HTTP_ERRNO_CALLBACK_MAP(XX) \
/* Callback-related errors */ \
XX(CB_message_begin, "the on_message_begin callback failed") \
XX(CB_url, "the on_url callback failed") \
Expand All @@ -249,7 +242,9 @@ enum flags
XX(CB_status, "the on_status callback failed") \
XX(CB_chunk_header, "the on_chunk_header callback failed") \
XX(CB_chunk_complete, "the on_chunk_complete callback failed") \
\

/* Map for parsing error related constans */
#define HTTP_ERRNO_PARSING_MAP(XX) \
/* Parsing-related errors */ \
XX(INVALID_EOF_STATE, "stream ended at an unexpected time") \
XX(HEADER_OVERFLOW, \
Expand Down Expand Up @@ -281,6 +276,15 @@ enum flags
XX(INVALID_TRANSFER_ENCODING, \
"request has invalid transfer-encoding") \

/* Map for errno-related constants
*
* The provided argument should be a macro that takes 2 arguments.
*/
#define HTTP_ERRNO_MAP(XX) \
/* No error */ \
XX(OK, "success") \
HTTP_ERRNO_CALLBACK_MAP(XX) \
HTTP_ERRNO_PARSING_MAP(XX) \

/* Define HPE_* values for each errno value above */
#define HTTP_ERRNO_GEN(n, s) HPE_##n,
Expand Down