]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
OPTIM: http: inline http_parse_chunk_size() and http_skip_chunk_crlf()
authorWilly Tarreau <w@1wt.eu>
Thu, 25 Oct 2012 22:49:52 +0000 (00:49 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 25 Oct 2012 23:12:40 +0000 (01:12 +0200)
These functions are not that long and the compiler inlines them well. Doing
so has sped up the chunked encoding parser by 41% !

Note that http_forward_trailers was also declared static because it's not
exported.

src/proto_http.c

index 62b7ca2d805fd2e00160e465a7bff1348a08a8c6..0c812d9e86c26a3417efdcc949ad970d62f8f171 100644 (file)
@@ -1745,7 +1745,7 @@ void http_change_connection_header(struct http_txn *txn, struct http_msg *msg, i
  * Return >0 on success, 0 when some data is missing, <0 on error.
  * Note: this function is designed to parse wrapped CRLF at the end of the buffer.
  */
-int http_parse_chunk_size(struct http_msg *msg)
+static inline int http_parse_chunk_size(struct http_msg *msg)
 {
        const struct buffer *buf = msg->chn->buf;
        const char *ptr = b_ptr(buf, msg->next);
@@ -1855,7 +1855,7 @@ int http_parse_chunk_size(struct http_msg *msg)
  * important to note that this function is designed to be able to parse wrapped
  * headers at end of buffer.
  */
-int http_forward_trailers(struct http_msg *msg)
+static int http_forward_trailers(struct http_msg *msg)
 {
        const struct buffer *buf = msg->chn->buf;
 
@@ -1929,7 +1929,7 @@ int http_forward_trailers(struct http_msg *msg)
  * does not change anything. Note: this function is designed to parse wrapped
  * CRLF at the end of the buffer.
  */
-int http_skip_chunk_crlf(struct http_msg *msg)
+static inline int http_skip_chunk_crlf(struct http_msg *msg)
 {
        const struct buffer *buf = msg->chn->buf;
        const char *ptr;