Skip to content
This repository has been archived by the owner on Jun 30, 2021. It is now read-only.

Commit

Permalink
[htparse] formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Ellzey committed Mar 19, 2015
1 parent c34dba5 commit 4adcc67
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions htparse/htparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,33 +202,33 @@ static const char * method_strmap[] = {
#ifndef HOST_BIG_ENDIAN
/* Little-endian cmp macros */
#define _str3_cmp(m, c0, c1, c2, c3) \
*(uint32_t*)m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)
*(uint32_t *)m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)

#define _str3Ocmp(m, c0, c1, c2, c3) \
*(uint32_t*)m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)
*(uint32_t *)m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)

#define _str4cmp(m, c0, c1, c2, c3) \
*(uint32_t*)m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)
*(uint32_t *)m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)

#define _str5cmp(m, c0, c1, c2, c3, c4) \
*(uint32_t*)m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0) \
#define _str5cmp(m, c0, c1, c2, c3, c4) \
*(uint32_t *)m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0) \
&& m[4] == c4

#define _str6cmp(m, c0, c1, c2, c3, c4, c5) \
*(uint32_t*)m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0) \
&& (((uint32_t*)m)[1] & 0xffff) == ((c5 << 8) | c4)
#define _str6cmp(m, c0, c1, c2, c3, c4, c5) \
*(uint32_t *)m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0) \
&& (((uint32_t *)m)[1] & 0xffff) == ((c5 << 8) | c4)

#define _str7_cmp(m, c0, c1, c2, c3, c4, c5, c6, c7) \
*(uint32_t*)m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0) \
&& ((uint32_t*)m)[1] == ((c7 << 24) | (c6 << 16) | (c5 << 8) | c4)
#define _str7_cmp(m, c0, c1, c2, c3, c4, c5, c6, c7) \
*(uint32_t *)m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0) \
&& ((uint32_t *)m)[1] == ((c7 << 24) | (c6 << 16) | (c5 << 8) | c4)

#define _str8cmp(m, c0, c1, c2, c3, c4, c5, c6, c7) \
*(uint32_t*)m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0) \
&& ((uint32_t*)m)[1] == ((c7 << 24) | (c6 << 16) | (c5 << 8) | c4)
#define _str8cmp(m, c0, c1, c2, c3, c4, c5, c6, c7) \
*(uint32_t *)m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0) \
&& ((uint32_t *)m)[1] == ((c7 << 24) | (c6 << 16) | (c5 << 8) | c4)

#define _str9cmp(m, c0, c1, c2, c3, c4, c5, c6, c7, c8) \
*(uint32_t*)m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0) \
&& ((uint32_t*)m)[1] == ((c7 << 24) | (c6 << 16) | (c5 << 8) | c4) \
#define _str9cmp(m, c0, c1, c2, c3, c4, c5, c6, c7, c8) \
*(uint32_t *)m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0) \
&& ((uint32_t *)m)[1] == ((c7 << 24) | (c6 << 16) | (c5 << 8) | c4) \
&& m[8] == c8
#else
/* Big endian cmp macros */
Expand Down Expand Up @@ -1608,7 +1608,7 @@ htparser_run(htparser * p, htparse_hooks * hooks, const char * data, size_t len)
break;
case eval_hdr_val_hostname:
if (hook_hostname_run(p, hooks, p->buf, p->buf_idx)) {
p->state = s_hdrline_hdr_almost_done;
p->state = s_hdrline_hdr_almost_done;
p->error = htparse_error_user;
return i + 1;
}
Expand Down Expand Up @@ -1914,7 +1914,7 @@ htparser_run(htparser * p, htparse_hooks * hooks, const char * data, size_t len)
res = 0;
{
const char * pp = &data[i];
const char * pe = (const char*)(data + len);
const char * pe = (const char *)(data + len);
size_t to_read = _MIN_READ(pe - pp, p->content_len);

if (to_read > 0) {
Expand Down Expand Up @@ -1967,7 +1967,7 @@ htparser_run(htparser * p, htparse_hooks * hooks, const char * data, size_t len)

{
const char * pp = &data[i];
const char * pe = (const char*)(data + len);
const char * pe = (const char *)(data + len);
size_t to_read = _MIN_READ(pe - pp, p->content_len);

if (to_read > 0) {
Expand Down

0 comments on commit 4adcc67

Please sign in to comment.