optimize code

Signed-off-by: Jianhui Zhao <jianhuizhao329@gmail.com>
main
Jianhui Zhao 2017-12-09 17:03:29 +08:00
parent 1873edb5ed
commit f096369b5b
2 changed files with 8 additions and 10 deletions

View File

@ -23,4 +23,12 @@ struct uh_str {
size_t len; size_t len;
}; };
/* Return 1 for equal */
static inline int uh_str_cmp(struct uh_str *uv, const char *str)
{
if (uv->len != strlen(str))
return 0;
return (!strncasecmp(uv->at, str, uv->len));
}
#endif #endif

View File

@ -182,16 +182,6 @@ static int on_body(http_parser *parser, const char *at, size_t len)
return 0; return 0;
} }
/* Return 1 for equal */
static int uh_str_cmp(struct uh_str *uv, const char *str)
{
if (uv->len != strlen(str))
return 0;
return (!strncasecmp(uv->at, str, uv->len));
}
static int on_message_complete(http_parser *parser) static int on_message_complete(http_parser *parser)
{ {
struct uh_connection *con = container_of(parser, struct uh_connection, parser); struct uh_connection *con = container_of(parser, struct uh_connection, parser);