Cleanup
This commit is contained in:
parent
c3ed20b75d
commit
9c58004a86
|
@ -597,7 +597,7 @@ static uint8_t* decode_length(ssize_t *res, uint8_t *in, uint8_t *last,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int emit_index_block(uint8_t **buf_ptr, size_t *buflen_ptr,
|
static int emit_indexed_block(uint8_t **buf_ptr, size_t *buflen_ptr,
|
||||||
size_t *offset_ptr, nghttp2_hd_entry *ent)
|
size_t *offset_ptr, nghttp2_hd_entry *ent)
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
|
@ -614,7 +614,7 @@ static int emit_index_block(uint8_t **buf_ptr, size_t *buflen_ptr,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int emit_literal_indname_block(uint8_t **buf_ptr, size_t *buflen_ptr,
|
static int emit_indname_block(uint8_t **buf_ptr, size_t *buflen_ptr,
|
||||||
size_t *offset_ptr, nghttp2_hd_entry *ent,
|
size_t *offset_ptr, nghttp2_hd_entry *ent,
|
||||||
const uint8_t *value, size_t valuelen,
|
const uint8_t *value, size_t valuelen,
|
||||||
int inc_indexing)
|
int inc_indexing)
|
||||||
|
@ -636,7 +636,7 @@ static int emit_literal_indname_block(uint8_t **buf_ptr, size_t *buflen_ptr,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int emit_literal_block(uint8_t **buf_ptr, size_t *buflen_ptr,
|
static int emit_newname_block(uint8_t **buf_ptr, size_t *buflen_ptr,
|
||||||
size_t *offset_ptr, nghttp2_nv *nv,
|
size_t *offset_ptr, nghttp2_nv *nv,
|
||||||
int inc_indexing)
|
int inc_indexing)
|
||||||
{
|
{
|
||||||
|
@ -682,7 +682,7 @@ static int emit_subst_indname_block(uint8_t **buf_ptr, size_t *buflen_ptr,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int emit_subst_literal_block(uint8_t **buf_ptr, size_t *buflen_ptr,
|
static int emit_subst_newname_block(uint8_t **buf_ptr, size_t *buflen_ptr,
|
||||||
size_t *offset_ptr, nghttp2_nv *nv,
|
size_t *offset_ptr, nghttp2_nv *nv,
|
||||||
size_t index)
|
size_t index)
|
||||||
{
|
{
|
||||||
|
@ -755,7 +755,7 @@ ssize_t nghttp2_hd_deflate_hd(nghttp2_hd_context *deflater,
|
||||||
if(rv < 0) {
|
if(rv < 0) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
rv = emit_index_block(buf_ptr, buflen_ptr, &offset, ent);
|
rv = emit_indexed_block(buf_ptr, buflen_ptr, &offset, ent);
|
||||||
if(rv < 0) {
|
if(rv < 0) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -765,7 +765,7 @@ ssize_t nghttp2_hd_deflate_hd(nghttp2_hd_context *deflater,
|
||||||
if(ent) {
|
if(ent) {
|
||||||
/* As long as no eviction kicked in, perform substitution */
|
/* As long as no eviction kicked in, perform substitution */
|
||||||
if(require_eviction_on_subst(deflater, &nv[i], ent)) {
|
if(require_eviction_on_subst(deflater, &nv[i], ent)) {
|
||||||
rv = emit_literal_indname_block(buf_ptr, buflen_ptr, &offset, ent,
|
rv = emit_indname_block(buf_ptr, buflen_ptr, &offset, ent,
|
||||||
nv[i].value, nv[i].valuelen, 0);
|
nv[i].value, nv[i].valuelen, 0);
|
||||||
} else {
|
} else {
|
||||||
nghttp2_hd_entry *new_ent;
|
nghttp2_hd_entry *new_ent;
|
||||||
|
@ -787,7 +787,7 @@ ssize_t nghttp2_hd_deflate_hd(nghttp2_hd_context *deflater,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rv = emit_literal_block(buf_ptr, buflen_ptr, &offset, &nv[i], 0);
|
rv = emit_newname_block(buf_ptr, buflen_ptr, &offset, &nv[i], 0);
|
||||||
if(rv < 0) {
|
if(rv < 0) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -799,7 +799,7 @@ ssize_t nghttp2_hd_deflate_hd(nghttp2_hd_context *deflater,
|
||||||
nghttp2_hd_ws_entry *ws_ent = &deflater->ws[i];
|
nghttp2_hd_ws_entry *ws_ent = &deflater->ws[i];
|
||||||
if(ws_ent->cat == NGHTTP2_HD_CAT_INDEXED &&
|
if(ws_ent->cat == NGHTTP2_HD_CAT_INDEXED &&
|
||||||
!ws_ent->indexed.checked) {
|
!ws_ent->indexed.checked) {
|
||||||
rv = emit_index_block(buf_ptr, buflen_ptr, &offset,
|
rv = emit_indexed_block(buf_ptr, buflen_ptr, &offset,
|
||||||
ws_ent->indexed.entry);
|
ws_ent->indexed.entry);
|
||||||
if(rv < 0) {
|
if(rv < 0) {
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -1092,15 +1092,15 @@ int nghttp2_hd_emit_indname_block(uint8_t **buf_ptr, size_t *buflen_ptr,
|
||||||
const uint8_t *value, size_t valuelen,
|
const uint8_t *value, size_t valuelen,
|
||||||
int inc_indexing)
|
int inc_indexing)
|
||||||
{
|
{
|
||||||
return emit_literal_indname_block(buf_ptr, buflen_ptr, offset_ptr,
|
return emit_indname_block(buf_ptr, buflen_ptr, offset_ptr,
|
||||||
ent, value, valuelen, inc_indexing);
|
ent, value, valuelen, inc_indexing);
|
||||||
}
|
}
|
||||||
|
|
||||||
int nghttp2_hd_emit_literal_block(uint8_t **buf_ptr, size_t *buflen_ptr,
|
int nghttp2_hd_emit_newname_block(uint8_t **buf_ptr, size_t *buflen_ptr,
|
||||||
size_t *offset_ptr, nghttp2_nv *nv,
|
size_t *offset_ptr, nghttp2_nv *nv,
|
||||||
int inc_indexing)
|
int inc_indexing)
|
||||||
{
|
{
|
||||||
return emit_literal_block(buf_ptr, buflen_ptr, offset_ptr, nv, inc_indexing);
|
return emit_newname_block(buf_ptr, buflen_ptr, offset_ptr, nv, inc_indexing);
|
||||||
}
|
}
|
||||||
|
|
||||||
int nghttp2_hd_emit_subst_indname_block(uint8_t **buf_ptr, size_t *buflen_ptr,
|
int nghttp2_hd_emit_subst_indname_block(uint8_t **buf_ptr, size_t *buflen_ptr,
|
||||||
|
@ -1113,9 +1113,9 @@ int nghttp2_hd_emit_subst_indname_block(uint8_t **buf_ptr, size_t *buflen_ptr,
|
||||||
ent, value, valuelen, index);
|
ent, value, valuelen, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
int nghttp2_hd_emit_subst_literal_block(uint8_t **buf_ptr, size_t *buflen_ptr,
|
int nghttp2_hd_emit_subst_newname_block(uint8_t **buf_ptr, size_t *buflen_ptr,
|
||||||
size_t *offset_ptr, nghttp2_nv *nv,
|
size_t *offset_ptr, nghttp2_nv *nv,
|
||||||
size_t index)
|
size_t index)
|
||||||
{
|
{
|
||||||
return emit_subst_literal_block(buf_ptr, buflen_ptr, offset_ptr, nv, index);
|
return emit_subst_newname_block(buf_ptr, buflen_ptr, offset_ptr, nv, index);
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,7 +225,7 @@ int nghttp2_hd_emit_indname_block(uint8_t **buf_ptr, size_t *buflen_ptr,
|
||||||
int inc_indexing);
|
int inc_indexing);
|
||||||
|
|
||||||
/* For unittesting purpose */
|
/* For unittesting purpose */
|
||||||
int nghttp2_hd_emit_literal_block(uint8_t **buf_ptr, size_t *buflen_ptr,
|
int nghttp2_hd_emit_newname_block(uint8_t **buf_ptr, size_t *buflen_ptr,
|
||||||
size_t *offset_ptr, nghttp2_nv *nv,
|
size_t *offset_ptr, nghttp2_nv *nv,
|
||||||
int inc_indexing);
|
int inc_indexing);
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ int nghttp2_hd_emit_subst_indname_block(uint8_t **buf_ptr, size_t *buflen_ptr,
|
||||||
size_t index);
|
size_t index);
|
||||||
|
|
||||||
/* For unittesting purpose */
|
/* For unittesting purpose */
|
||||||
int nghttp2_hd_emit_subst_literal_block(uint8_t **buf_ptr, size_t *buflen_ptr,
|
int nghttp2_hd_emit_subst_newname_block(uint8_t **buf_ptr, size_t *buflen_ptr,
|
||||||
size_t *offset_ptr, nghttp2_nv *nv,
|
size_t *offset_ptr, nghttp2_nv *nv,
|
||||||
size_t index);
|
size_t index);
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,7 @@ void test_nghttp2_hd_inflate_newname_inc(void)
|
||||||
nghttp2_nv *resnva;
|
nghttp2_nv *resnva;
|
||||||
nghttp2_hd_inflate_init(&inflater, NGHTTP2_HD_SIDE_SERVER);
|
nghttp2_hd_inflate_init(&inflater, NGHTTP2_HD_SIDE_SERVER);
|
||||||
|
|
||||||
CU_ASSERT(0 == nghttp2_hd_emit_literal_block(&buf, &buflen, &offset,
|
CU_ASSERT(0 == nghttp2_hd_emit_newname_block(&buf, &buflen, &offset,
|
||||||
&nv, 1));
|
&nv, 1));
|
||||||
CU_ASSERT(1 == nghttp2_hd_inflate_hd(&inflater, &resnva, buf, offset));
|
CU_ASSERT(1 == nghttp2_hd_inflate_hd(&inflater, &resnva, buf, offset));
|
||||||
assert_nv_equal(&nv, resnva, 1);
|
assert_nv_equal(&nv, resnva, 1);
|
||||||
|
@ -267,7 +267,7 @@ void test_nghttp2_hd_inflate_newname_subst(void)
|
||||||
nghttp2_nv *resnva;
|
nghttp2_nv *resnva;
|
||||||
nghttp2_hd_inflate_init(&inflater, NGHTTP2_HD_SIDE_SERVER);
|
nghttp2_hd_inflate_init(&inflater, NGHTTP2_HD_SIDE_SERVER);
|
||||||
|
|
||||||
CU_ASSERT(0 == nghttp2_hd_emit_subst_literal_block(&buf, &buflen, &offset,
|
CU_ASSERT(0 == nghttp2_hd_emit_subst_newname_block(&buf, &buflen, &offset,
|
||||||
&nv, 1));
|
&nv, 1));
|
||||||
CU_ASSERT(1 == nghttp2_hd_inflate_hd(&inflater, &resnva, buf, offset));
|
CU_ASSERT(1 == nghttp2_hd_inflate_hd(&inflater, &resnva, buf, offset));
|
||||||
assert_nv_equal(&nv, resnva, 1);
|
assert_nv_equal(&nv, resnva, 1);
|
||||||
|
|
Loading…
Reference in New Issue