Simplify vry_cmp's signature

parent 5b8d8964
...@@ -145,18 +145,18 @@ vry_len(const uint8_t *p) ...@@ -145,18 +145,18 @@ vry_len(const uint8_t *p)
* Compare two vary entries * Compare two vary entries
*/ */
static int static int
vry_cmp(const uint8_t * const *v1, uint8_t * const *v2) vry_cmp(const uint8_t *v1, const uint8_t *v2)
{ {
unsigned retval = 0; unsigned retval = 0;
if (!memcmp(*v1, *v2, vry_len(*v1))) { if (!memcmp(v1, v2, vry_len(v1))) {
/* Same same */ /* Same same */
retval = 0; retval = 0;
} else if (memcmp((*v1) + 2, (*v2) + 2, (*v1)[2] + 2)) { } else if (memcmp(v1 + 2, v2 + 2, v1[2] + 2)) {
/* Different header */ /* Different header */
retval = 1; retval = 1;
} else if (cache_param->http_gzip_support && } else if (cache_param->http_gzip_support &&
!strcasecmp(H_Accept_Encoding, (const char*)((*v1)+2))) { !strcasecmp(H_Accept_Encoding, (const char*) v1 + 2)) {
/* /*
* If we do gzip processing, we do not vary on Accept-Encoding, * If we do gzip processing, we do not vary on Accept-Encoding,
* because we want everybody to get the gzip'ed object, and * because we want everybody to get the gzip'ed object, and
...@@ -183,7 +183,7 @@ VRY_Match(const struct sess *sp, const uint8_t *vary) ...@@ -183,7 +183,7 @@ VRY_Match(const struct sess *sp, const uint8_t *vary)
AN(vsp); AN(vsp);
while (vary[2]) { while (vary[2]) {
i = vry_cmp(&vary, &vsp); i = vry_cmp(vary, vsp);
if (i == 1) { if (i == 1) {
/* Build a new entry */ /* Build a new entry */
...@@ -222,7 +222,7 @@ VRY_Match(const struct sess *sp, const uint8_t *vary) ...@@ -222,7 +222,7 @@ VRY_Match(const struct sess *sp, const uint8_t *vary)
} else } else
vsp[2 + vary[2] + 2 + 2] = '\0'; vsp[2 + vary[2] + 2 + 2] = '\0';
i = vry_cmp(&vary, &vsp); i = vry_cmp(vary, vsp);
assert(i != 1); /* hdr must be the same now */ assert(i != 1); /* hdr must be the same now */
} }
if (i != 0) if (i != 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment