mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-03 03:52:38 +00:00
[OPTIM] used unsigned ints for HTTP state and message offsets
State and offsets within http_msg were incorrectly set to signed int. Turning them into unsigned slightly improved performance while reducing code size.
This commit is contained in:
parent
cf1d572f2a
commit
e69eada057
@ -204,12 +204,12 @@ typedef enum {
|
|||||||
* which marks the end of the line (LF or CRLF).
|
* which marks the end of the line (LF or CRLF).
|
||||||
*/
|
*/
|
||||||
struct http_msg {
|
struct http_msg {
|
||||||
int msg_state; /* where we are in the current message parsing */
|
unsigned int msg_state; /* where we are in the current message parsing */
|
||||||
char *sol; /* start of line, also start of message when fully parsed */
|
char *sol; /* start of line, also start of message when fully parsed */
|
||||||
char *eol; /* end of line */
|
char *eol; /* end of line */
|
||||||
int som; /* Start Of Message, relative to buffer */
|
unsigned int som; /* Start Of Message, relative to buffer */
|
||||||
int col, sov; /* current header: colon, start of value */
|
unsigned int col, sov; /* current header: colon, start of value */
|
||||||
int eoh; /* End Of Headers, relative to buffer */
|
unsigned int eoh; /* End Of Headers, relative to buffer */
|
||||||
char **cap; /* array of captured headers (may be NULL) */
|
char **cap; /* array of captured headers (may be NULL) */
|
||||||
union { /* useful start line pointers, relative to buffer */
|
union { /* useful start line pointers, relative to buffer */
|
||||||
struct {
|
struct {
|
||||||
|
@ -937,9 +937,9 @@ void capture_headers(char *som, struct hdr_idx *idx,
|
|||||||
* within its state machine and use the same macros, hence the need for same
|
* within its state machine and use the same macros, hence the need for same
|
||||||
* labels and variable names. Note that msg->sol is left unchanged.
|
* labels and variable names. Note that msg->sol is left unchanged.
|
||||||
*/
|
*/
|
||||||
const char *http_parse_stsline(struct http_msg *msg, const char *msg_buf, int state,
|
const char *http_parse_stsline(struct http_msg *msg, const char *msg_buf,
|
||||||
const char *ptr, const char *end,
|
unsigned int state, const char *ptr, const char *end,
|
||||||
char **ret_ptr, int *ret_state)
|
char **ret_ptr, unsigned int *ret_state)
|
||||||
{
|
{
|
||||||
__label__
|
__label__
|
||||||
http_msg_rpver,
|
http_msg_rpver,
|
||||||
@ -1060,9 +1060,9 @@ const char *http_parse_stsline(struct http_msg *msg, const char *msg_buf, int st
|
|||||||
* within its state machine and use the same macros, hence the need for same
|
* within its state machine and use the same macros, hence the need for same
|
||||||
* labels and variable names. Note that msg->sol is left unchanged.
|
* labels and variable names. Note that msg->sol is left unchanged.
|
||||||
*/
|
*/
|
||||||
const char *http_parse_reqline(struct http_msg *msg, const char *msg_buf, int state,
|
const char *http_parse_reqline(struct http_msg *msg, const char *msg_buf,
|
||||||
const char *ptr, const char *end,
|
unsigned int state, const char *ptr, const char *end,
|
||||||
char **ret_ptr, int *ret_state)
|
char **ret_ptr, unsigned int *ret_state)
|
||||||
{
|
{
|
||||||
__label__
|
__label__
|
||||||
http_msg_rqmeth,
|
http_msg_rqmeth,
|
||||||
@ -1206,7 +1206,7 @@ void http_msg_analyzer(struct buffer *buf, struct http_msg *msg, struct hdr_idx
|
|||||||
http_msg_ood, /* out of data */
|
http_msg_ood, /* out of data */
|
||||||
http_msg_invalid;
|
http_msg_invalid;
|
||||||
|
|
||||||
int state; /* updated only when leaving the FSM */
|
unsigned int state; /* updated only when leaving the FSM */
|
||||||
register char *ptr, *end; /* request pointers, to avoid dereferences */
|
register char *ptr, *end; /* request pointers, to avoid dereferences */
|
||||||
|
|
||||||
state = msg->msg_state;
|
state = msg->msg_state;
|
||||||
|
Loading…
Reference in New Issue
Block a user