diff --git a/lib/nghttp2_buf.c b/lib/nghttp2_buf.c index 9a91fbce..b85e1e60 100644 --- a/lib/nghttp2_buf.c +++ b/lib/nghttp2_buf.c @@ -96,8 +96,7 @@ void nghttp2_buf_wrap_init(nghttp2_buf *buf, uint8_t *begin, size_t len) buf->end = begin + len; } -static int nghttp2_buf_chain_new(nghttp2_buf_chain **chain, - size_t chunk_length) +static int buf_chain_new(nghttp2_buf_chain **chain, size_t chunk_length) { int rv; @@ -117,7 +116,7 @@ static int nghttp2_buf_chain_new(nghttp2_buf_chain **chain, return 0; } -static void nghttp2_buf_chain_del(nghttp2_buf_chain *chain) +static void buf_chain_del(nghttp2_buf_chain *chain) { nghttp2_buf_free(&chain->buf); free(chain); @@ -145,7 +144,7 @@ int nghttp2_bufs_init3(nghttp2_bufs *bufs, size_t chunk_length, return NGHTTP2_ERR_INVALID_ARGUMENT; } - rv = nghttp2_buf_chain_new(&chain, chunk_length); + rv = buf_chain_new(&chain, chunk_length); if(rv != 0) { return rv; } @@ -172,7 +171,7 @@ void nghttp2_bufs_free(nghttp2_bufs *bufs) for(chain = bufs->head; chain;) { next_chain = chain->next; - nghttp2_buf_chain_del(chain); + buf_chain_del(chain); chain = next_chain; } @@ -204,13 +203,13 @@ ssize_t nghttp2_bufs_len(nghttp2_bufs *bufs) return len; } -static int nghttp2_bufs_avail(nghttp2_bufs *bufs) +static int bufs_avail(nghttp2_bufs *bufs) { return nghttp2_buf_avail(&bufs->cur->buf) + (bufs->chunk_length - bufs->offset) * (bufs->max_chunk - bufs->chunk_used); } -static int nghttp2_bufs_alloc_chain(nghttp2_bufs *bufs) +static int bufs_alloc_chain(nghttp2_bufs *bufs) { int rv; nghttp2_buf_chain *chain; @@ -225,7 +224,7 @@ static int nghttp2_bufs_alloc_chain(nghttp2_bufs *bufs) return NGHTTP2_ERR_BUFFER_ERROR; } - rv = nghttp2_buf_chain_new(&chain, bufs->chunk_length); + rv = buf_chain_new(&chain, bufs->chunk_length); if(rv != 0) { return rv; } @@ -251,7 +250,7 @@ int nghttp2_bufs_add(nghttp2_bufs *bufs, const void *data, size_t len) nghttp2_buf *buf; const uint8_t *p; - if(nghttp2_bufs_avail(bufs) < (ssize_t)len) { + if(bufs_avail(bufs) < (ssize_t)len) { return NGHTTP2_ERR_BUFFER_ERROR; } @@ -262,7 +261,7 @@ int nghttp2_bufs_add(nghttp2_bufs *bufs, const void *data, size_t len) nwrite = nghttp2_min((size_t)nghttp2_buf_avail(buf), len); if(nwrite == 0) { - rv = nghttp2_bufs_alloc_chain(bufs); + rv = bufs_alloc_chain(bufs); if(rv != 0) { return rv; } @@ -277,7 +276,7 @@ int nghttp2_bufs_add(nghttp2_bufs *bufs, const void *data, size_t len) return 0; } -static int nghttp2_bufs_ensure_addb(nghttp2_bufs *bufs) +static int bufs_ensure_addb(nghttp2_bufs *bufs) { int rv; nghttp2_buf *buf; @@ -288,7 +287,7 @@ static int nghttp2_bufs_ensure_addb(nghttp2_bufs *bufs) return 0; } - rv = nghttp2_bufs_alloc_chain(bufs); + rv = bufs_alloc_chain(bufs); if(rv != 0) { return rv; } @@ -300,7 +299,7 @@ int nghttp2_bufs_addb(nghttp2_bufs *bufs, uint8_t b) { int rv; - rv = nghttp2_bufs_ensure_addb(bufs); + rv = bufs_ensure_addb(bufs); if(rv != 0) { return rv; } @@ -314,7 +313,7 @@ int nghttp2_bufs_addb_hold(nghttp2_bufs *bufs, uint8_t b) { int rv; - rv = nghttp2_bufs_ensure_addb(bufs); + rv = bufs_ensure_addb(bufs); if(rv != 0) { return rv; } @@ -328,7 +327,7 @@ int nghttp2_bufs_orb(nghttp2_bufs *bufs, uint8_t b) { int rv; - rv = nghttp2_bufs_ensure_addb(bufs); + rv = bufs_ensure_addb(bufs); if(rv != 0) { return rv; } @@ -342,7 +341,7 @@ int nghttp2_bufs_orb_hold(nghttp2_bufs *bufs, uint8_t b) { int rv; - rv = nghttp2_bufs_ensure_addb(bufs); + rv = bufs_ensure_addb(bufs); if(rv != 0) { return rv; } @@ -416,7 +415,7 @@ void nghttp2_bufs_reset(nghttp2_bufs *bufs) for(ci = chain; ci;) { chain = ci->next; - nghttp2_buf_chain_del(ci); + buf_chain_del(ci); ci = chain; } @@ -429,7 +428,7 @@ void nghttp2_bufs_reset(nghttp2_bufs *bufs) int nghttp2_bufs_advance(nghttp2_bufs *bufs) { - return nghttp2_bufs_alloc_chain(bufs); + return bufs_alloc_chain(bufs); } int nghttp2_bufs_next_present(nghttp2_bufs *bufs) diff --git a/lib/nghttp2_frame.c b/lib/nghttp2_frame.c index 8c85f0eb..154a8e35 100644 --- a/lib/nghttp2_frame.c +++ b/lib/nghttp2_frame.c @@ -54,9 +54,9 @@ void nghttp2_frame_unpack_frame_hd(nghttp2_frame_hd *hd, const uint8_t* buf) hd->stream_id = nghttp2_get_uint32(&buf[4]) & NGHTTP2_STREAM_ID_MASK; } -static void nghttp2_frame_set_hd(nghttp2_frame_hd *hd, uint16_t length, - uint8_t type, uint8_t flags, - int32_t stream_id) +static void frame_set_hd(nghttp2_frame_hd *hd, uint16_t length, + uint8_t type, uint8_t flags, + int32_t stream_id) { hd->length = length; hd->type = type; @@ -70,7 +70,7 @@ void nghttp2_frame_headers_init(nghttp2_headers *frame, const nghttp2_priority_spec *pri_spec, nghttp2_nv *nva, size_t nvlen) { - nghttp2_frame_set_hd(&frame->hd, 0, NGHTTP2_HEADERS, flags, stream_id); + frame_set_hd(&frame->hd, 0, NGHTTP2_HEADERS, flags, stream_id); frame->padlen = 0; frame->nva = nva; frame->nvlen = nvlen; @@ -91,8 +91,8 @@ void nghttp2_frame_headers_free(nghttp2_headers *frame) void nghttp2_frame_priority_init(nghttp2_priority *frame, int32_t stream_id, const nghttp2_priority_spec *pri_spec) { - nghttp2_frame_set_hd(&frame->hd, 5, NGHTTP2_PRIORITY, NGHTTP2_FLAG_NONE, - stream_id); + frame_set_hd(&frame->hd, 5, NGHTTP2_PRIORITY, NGHTTP2_FLAG_NONE, + stream_id); frame->pri_spec = *pri_spec; } @@ -103,8 +103,8 @@ void nghttp2_frame_rst_stream_init(nghttp2_rst_stream *frame, int32_t stream_id, nghttp2_error_code error_code) { - nghttp2_frame_set_hd(&frame->hd, 4, NGHTTP2_RST_STREAM, NGHTTP2_FLAG_NONE, - stream_id); + frame_set_hd(&frame->hd, 4, NGHTTP2_RST_STREAM, NGHTTP2_FLAG_NONE, + stream_id); frame->error_code = error_code; } @@ -115,8 +115,8 @@ void nghttp2_frame_rst_stream_free(nghttp2_rst_stream *frame) void nghttp2_frame_settings_init(nghttp2_settings *frame, uint8_t flags, nghttp2_settings_entry *iv, size_t niv) { - nghttp2_frame_set_hd(&frame->hd, niv * NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH, - NGHTTP2_SETTINGS, flags, 0); + frame_set_hd(&frame->hd, niv * NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH, + NGHTTP2_SETTINGS, flags, 0); frame->niv = niv; frame->iv = iv; } @@ -131,7 +131,7 @@ void nghttp2_frame_push_promise_init(nghttp2_push_promise *frame, int32_t promised_stream_id, nghttp2_nv *nva, size_t nvlen) { - nghttp2_frame_set_hd(&frame->hd, 0, NGHTTP2_PUSH_PROMISE, flags, stream_id); + frame_set_hd(&frame->hd, 0, NGHTTP2_PUSH_PROMISE, flags, stream_id); frame->padlen = 0; frame->nva = nva; frame->nvlen = nvlen; @@ -146,7 +146,7 @@ void nghttp2_frame_push_promise_free(nghttp2_push_promise *frame) void nghttp2_frame_ping_init(nghttp2_ping *frame, uint8_t flags, const uint8_t *opaque_data) { - nghttp2_frame_set_hd(&frame->hd, 8, NGHTTP2_PING, flags, 0); + frame_set_hd(&frame->hd, 8, NGHTTP2_PING, flags, 0); if(opaque_data) { memcpy(frame->opaque_data, opaque_data, sizeof(frame->opaque_data)); } else { @@ -161,8 +161,8 @@ void nghttp2_frame_goaway_init(nghttp2_goaway *frame, int32_t last_stream_id, nghttp2_error_code error_code, uint8_t *opaque_data, size_t opaque_data_len) { - nghttp2_frame_set_hd(&frame->hd, 8+opaque_data_len, NGHTTP2_GOAWAY, - NGHTTP2_FLAG_NONE, 0); + frame_set_hd(&frame->hd, 8+opaque_data_len, NGHTTP2_GOAWAY, + NGHTTP2_FLAG_NONE, 0); frame->last_stream_id = last_stream_id; frame->error_code = error_code; frame->opaque_data = opaque_data; @@ -179,7 +179,7 @@ void nghttp2_frame_window_update_init(nghttp2_window_update *frame, int32_t stream_id, int32_t window_size_increment) { - nghttp2_frame_set_hd(&frame->hd, 4, NGHTTP2_WINDOW_UPDATE, flags, stream_id); + frame_set_hd(&frame->hd, 4, NGHTTP2_WINDOW_UPDATE, flags, stream_id); frame->window_size_increment = window_size_increment; } @@ -199,8 +199,8 @@ void nghttp2_frame_altsvc_init(nghttp2_altsvc *frame, int32_t stream_id, /* 8 for Max-Age, Port, Reserved and PID_LEN. 1 for HOST_LEN. */ payloadlen = 8 + protocol_id_len + 1 + host_len + origin_len; - nghttp2_frame_set_hd(&frame->hd, payloadlen, NGHTTP2_ALTSVC, - NGHTTP2_FLAG_NONE, stream_id); + frame_set_hd(&frame->hd, payloadlen, NGHTTP2_ALTSVC, NGHTTP2_FLAG_NONE, + stream_id); frame->max_age = max_age; frame->port = port; @@ -219,8 +219,8 @@ void nghttp2_frame_altsvc_free(nghttp2_altsvc *frame) void nghttp2_frame_blocked_init(nghttp2_blocked *frame, int32_t stream_id) { - nghttp2_frame_set_hd(&frame->hd, 0, NGHTTP2_BLOCKED, NGHTTP2_FLAG_NONE, - stream_id); + frame_set_hd(&frame->hd, 0, NGHTTP2_BLOCKED, NGHTTP2_FLAG_NONE, + stream_id); } void nghttp2_frame_blocked_free(nghttp2_blocked *frame) @@ -251,7 +251,7 @@ void nghttp2_frame_private_data_init(nghttp2_private_data *frame, const nghttp2_data_provider *data_prd) { /* At this moment, the length of DATA frame is unknown */ - nghttp2_frame_set_hd(&frame->hd, 0, NGHTTP2_DATA, flags, stream_id); + frame_set_hd(&frame->hd, 0, NGHTTP2_DATA, flags, stream_id); frame->data_prd = *data_prd; frame->padlen = 0; frame->eof = 0; diff --git a/lib/nghttp2_hd.c b/lib/nghttp2_hd.c index da03163f..b0469719 100644 --- a/lib/nghttp2_hd.c +++ b/lib/nghttp2_hd.c @@ -213,8 +213,7 @@ void nghttp2_hd_entry_free(nghttp2_hd_entry *ent) } } -static int nghttp2_hd_ringbuf_init(nghttp2_hd_ringbuf *ringbuf, - size_t bufsize) +static int hd_ringbuf_init(nghttp2_hd_ringbuf *ringbuf, size_t bufsize) { size_t size; for(size = 1; size < bufsize; size <<= 1); @@ -228,15 +227,14 @@ static int nghttp2_hd_ringbuf_init(nghttp2_hd_ringbuf *ringbuf, return 0; } -static nghttp2_hd_entry* nghttp2_hd_ringbuf_get(nghttp2_hd_ringbuf *ringbuf, - size_t index) +static nghttp2_hd_entry* hd_ringbuf_get(nghttp2_hd_ringbuf *ringbuf, + size_t index) { assert(index < ringbuf->len); return ringbuf->buffer[(ringbuf->first + index) & ringbuf->mask]; } -static int nghttp2_hd_ringbuf_reserve(nghttp2_hd_ringbuf *ringbuf, - size_t bufsize) +static int hd_ringbuf_reserve(nghttp2_hd_ringbuf *ringbuf, size_t bufsize) { size_t i; size_t size; @@ -251,7 +249,7 @@ static int nghttp2_hd_ringbuf_reserve(nghttp2_hd_ringbuf *ringbuf, return NGHTTP2_ERR_NOMEM; } for(i = 0; i < ringbuf->len; ++i) { - buffer[i] = nghttp2_hd_ringbuf_get(ringbuf, i); + buffer[i] = hd_ringbuf_get(ringbuf, i); } free(ringbuf->buffer); ringbuf->buffer = buffer; @@ -260,14 +258,14 @@ static int nghttp2_hd_ringbuf_reserve(nghttp2_hd_ringbuf *ringbuf, return 0; } -static void nghttp2_hd_ringbuf_free(nghttp2_hd_ringbuf *ringbuf) +static void hd_ringbuf_free(nghttp2_hd_ringbuf *ringbuf) { size_t i; if(ringbuf == NULL) { return; } for(i = 0; i < ringbuf->len; ++i) { - nghttp2_hd_entry *ent = nghttp2_hd_ringbuf_get(ringbuf, i); + nghttp2_hd_entry *ent = hd_ringbuf_get(ringbuf, i); --ent->ref; nghttp2_hd_entry_free(ent); free(ent); @@ -275,8 +273,8 @@ static void nghttp2_hd_ringbuf_free(nghttp2_hd_ringbuf *ringbuf) free(ringbuf->buffer); } -static size_t nghttp2_hd_ringbuf_push_front(nghttp2_hd_ringbuf *ringbuf, - nghttp2_hd_entry *ent) +static size_t hd_ringbuf_push_front(nghttp2_hd_ringbuf *ringbuf, + nghttp2_hd_entry *ent) { assert(ringbuf->len <= ringbuf->mask); ringbuf->buffer[--ringbuf->first & ringbuf->mask] = ent; @@ -284,20 +282,20 @@ static size_t nghttp2_hd_ringbuf_push_front(nghttp2_hd_ringbuf *ringbuf, return 0; } -static void nghttp2_hd_ringbuf_pop_back(nghttp2_hd_ringbuf *ringbuf) +static void hd_ringbuf_pop_back(nghttp2_hd_ringbuf *ringbuf) { assert(ringbuf->len > 0); --ringbuf->len; } -static int nghttp2_hd_context_init(nghttp2_hd_context *context, - nghttp2_hd_role role) +static int hd_context_init(nghttp2_hd_context *context, + nghttp2_hd_role role) { int rv; context->role = role; context->bad = 0; context->hd_table_bufsize_max = NGHTTP2_HD_DEFAULT_MAX_BUFFER_SIZE; - rv = nghttp2_hd_ringbuf_init + rv = hd_ringbuf_init (&context->hd_table, context->hd_table_bufsize_max/NGHTTP2_HD_ENTRY_OVERHEAD); if(rv != 0) { @@ -308,9 +306,9 @@ static int nghttp2_hd_context_init(nghttp2_hd_context *context, return 0; } -static void nghttp2_hd_context_free(nghttp2_hd_context *context) +static void hd_context_free(nghttp2_hd_context *context) { - nghttp2_hd_ringbuf_free(&context->hd_table); + hd_ringbuf_free(&context->hd_table); } int nghttp2_hd_deflate_init(nghttp2_hd_deflater *deflater) @@ -323,7 +321,7 @@ int nghttp2_hd_deflate_init2(nghttp2_hd_deflater *deflater, size_t deflate_hd_table_bufsize_max) { int rv; - rv = nghttp2_hd_context_init(&deflater->ctx, NGHTTP2_HD_ROLE_DEFLATE); + rv = hd_context_init(&deflater->ctx, NGHTTP2_HD_ROLE_DEFLATE); if(rv != 0) { return rv; } @@ -336,7 +334,7 @@ int nghttp2_hd_inflate_init(nghttp2_hd_inflater *inflater) { int rv; - rv = nghttp2_hd_context_init(&inflater->ctx, NGHTTP2_HD_ROLE_INFLATE); + rv = hd_context_init(&inflater->ctx, NGHTTP2_HD_ROLE_INFLATE); if(rv != 0) { goto fail; } @@ -376,7 +374,7 @@ int nghttp2_hd_inflate_init(nghttp2_hd_inflater *inflater) valuebuf_fail: nghttp2_bufs_free(&inflater->namebufs); namebuf_fail: - nghttp2_hd_context_free(&inflater->ctx); + hd_context_free(&inflater->ctx); fail: return rv; } @@ -398,7 +396,7 @@ static void hd_inflate_keep_free(nghttp2_hd_inflater *inflater) void nghttp2_hd_deflate_free(nghttp2_hd_deflater *deflater) { - nghttp2_hd_context_free(&deflater->ctx); + hd_context_free(&deflater->ctx); } void nghttp2_hd_inflate_free(nghttp2_hd_inflater *inflater) @@ -406,7 +404,7 @@ void nghttp2_hd_inflate_free(nghttp2_hd_inflater *inflater) hd_inflate_keep_free(inflater); nghttp2_bufs_free(&inflater->namebufs); nghttp2_bufs_free(&inflater->valuebufs); - nghttp2_hd_context_free(&inflater->ctx); + hd_context_free(&inflater->ctx); } void nghttp2_hd_deflate_set_no_refset(nghttp2_hd_deflater *deflater, @@ -511,7 +509,7 @@ static size_t encode_length(uint8_t *buf, size_t n, int prefix) * error. */ static uint8_t* decode_length(ssize_t *res, int *final, ssize_t initial, - uint8_t *in, uint8_t *last, int prefix) + uint8_t *in, uint8_t *last, int prefix) { int k = (1 << prefix) - 1, r; ssize_t n = initial; @@ -552,7 +550,7 @@ static uint8_t* decode_length(ssize_t *res, int *final, ssize_t initial, return in + 1; } -static int nghttp2_hd_handle_buffer_error(int rv) +static int hd_handle_buffer_error(int rv) { if(rv == NGHTTP2_ERR_BUFFER_ERROR) { return NGHTTP2_ERR_HEADER_COMP; @@ -568,7 +566,7 @@ static int emit_clear_refset(nghttp2_bufs *bufs) rv = nghttp2_bufs_addb(bufs, 0x30u); if(rv != 0) { - return nghttp2_hd_handle_buffer_error(rv); + return hd_handle_buffer_error(rv); } return 0; @@ -597,7 +595,7 @@ static int emit_table_size(nghttp2_bufs *bufs, size_t table_size) rv = nghttp2_bufs_add(bufs, sb, blocklen); if(rv != 0) { - return nghttp2_hd_handle_buffer_error(rv); + return hd_handle_buffer_error(rv); } return 0; @@ -625,7 +623,7 @@ static int emit_indexed_block(nghttp2_bufs *bufs, size_t index) rv = nghttp2_bufs_add(bufs, sb, blocklen); if(rv != 0) { - return nghttp2_hd_handle_buffer_error(rv); + return hd_handle_buffer_error(rv); } return 0; @@ -658,7 +656,7 @@ static int emit_string(nghttp2_bufs *bufs, rv = nghttp2_bufs_add(bufs, sb, blocklen); if(rv != 0) { - return nghttp2_hd_handle_buffer_error(rv); + return hd_handle_buffer_error(rv); } if(huffman) { @@ -668,7 +666,7 @@ static int emit_string(nghttp2_bufs *bufs, rv = nghttp2_bufs_add(bufs, str, len); } - return nghttp2_hd_handle_buffer_error(rv); + return hd_handle_buffer_error(rv); } static uint8_t pack_first_byte(int inc_indexing, int no_index) @@ -730,7 +728,7 @@ static int emit_indname_block(nghttp2_bufs *bufs, size_t index, rv = nghttp2_bufs_add(bufs, sb, blocklen); if(rv != 0) { - return nghttp2_hd_handle_buffer_error(rv); + return hd_handle_buffer_error(rv); } rv = emit_string(bufs, encvallen, huffman, nv->value, nv->valuelen); @@ -772,7 +770,7 @@ static int emit_newname_block(nghttp2_bufs *bufs, nghttp2_nv *nv, rv = nghttp2_bufs_addb(bufs, pack_first_byte(inc_indexing, no_index)); if(rv != 0) { - return nghttp2_hd_handle_buffer_error(rv); + return hd_handle_buffer_error(rv); } rv = emit_string(bufs, encnamelen, name_huffman, nv->name, nv->namelen); @@ -820,7 +818,7 @@ static nghttp2_hd_entry* add_hd_table_incremental(nghttp2_hd_context *context, context->hd_table.len > 0) { size_t index = context->hd_table.len - 1; - nghttp2_hd_entry* ent = nghttp2_hd_ringbuf_get(&context->hd_table, index); + nghttp2_hd_entry* ent = hd_ringbuf_get(&context->hd_table, index); context->hd_table_bufsize -= entry_room(ent->nv.namelen, ent->nv.valuelen); if(context->role == NGHTTP2_HD_ROLE_DEFLATE) { @@ -839,7 +837,7 @@ static nghttp2_hd_entry* add_hd_table_incremental(nghttp2_hd_context *context, DEBUGF(fprintf(stderr, ": ")); DEBUGF(fwrite(ent->nv.value, ent->nv.valuelen, 1, stderr)); DEBUGF(fprintf(stderr, "\n")); - nghttp2_hd_ringbuf_pop_back(&context->hd_table); + hd_ringbuf_pop_back(&context->hd_table); if(--ent->ref == 0) { nghttp2_hd_entry_free(ent); free(ent); @@ -864,7 +862,7 @@ static nghttp2_hd_entry* add_hd_table_incremental(nghttp2_hd_context *context, --new_ent->ref; } else { context->hd_table_bufsize += room; - nghttp2_hd_ringbuf_push_front(&context->hd_table, new_ent); + hd_ringbuf_push_front(&context->hd_table, new_ent); new_ent->flags |= NGHTTP2_HD_FLAG_REFSET; } @@ -899,7 +897,7 @@ static search_result search_hd_table(nghttp2_hd_context *context, if(use_index) { for(i = 0; i < context->hd_table.len; ++i) { - nghttp2_hd_entry *ent = nghttp2_hd_ringbuf_get(&context->hd_table, i); + nghttp2_hd_entry *ent = hd_ringbuf_get(&context->hd_table, i); if(ent->name_hash == name_hash && name_eq(&ent->nv, nv)) { if(res.index == -1) { res.index = i; @@ -948,9 +946,9 @@ static void hd_context_shrink_table_size(nghttp2_hd_context *context) while(context->hd_table_bufsize > context->hd_table_bufsize_max && context->hd_table.len > 0) { size_t index = context->hd_table.len - 1; - nghttp2_hd_entry* ent = nghttp2_hd_ringbuf_get(&context->hd_table, index); + nghttp2_hd_entry* ent = hd_ringbuf_get(&context->hd_table, index); context->hd_table_bufsize -= entry_room(ent->nv.namelen, ent->nv.valuelen); - nghttp2_hd_ringbuf_pop_back(&context->hd_table); + hd_ringbuf_pop_back(&context->hd_table); if(--ent->ref == 0) { nghttp2_hd_entry_free(ent); free(ent); @@ -964,7 +962,7 @@ int nghttp2_hd_deflate_change_table_size(nghttp2_hd_deflater *deflater, int rv; size_t next_bufsize = nghttp2_min(settings_hd_table_bufsize_max, deflater->deflate_hd_table_bufsize_max); - rv = nghttp2_hd_ringbuf_reserve + rv = hd_ringbuf_reserve (&deflater->ctx.hd_table, next_bufsize / NGHTTP2_HD_ENTRY_OVERHEAD); if(rv != 0) { return rv; @@ -987,7 +985,7 @@ int nghttp2_hd_inflate_change_table_size(nghttp2_hd_inflater *inflater, { int rv; - rv = nghttp2_hd_ringbuf_reserve + rv = hd_ringbuf_reserve (&inflater->ctx.hd_table, settings_hd_table_bufsize_max / NGHTTP2_HD_ENTRY_OVERHEAD); if(rv != 0) { @@ -1003,7 +1001,7 @@ static void clear_refset(nghttp2_hd_context *context) { size_t i; for(i = 0; i < context->hd_table.len; ++i) { - nghttp2_hd_entry *ent = nghttp2_hd_ringbuf_get(&context->hd_table, i); + nghttp2_hd_entry *ent = hd_ringbuf_get(&context->hd_table, i); ent->flags &= ~NGHTTP2_HD_FLAG_REFSET; } } @@ -1023,7 +1021,7 @@ nghttp2_hd_entry* nghttp2_hd_table_get(nghttp2_hd_context *context, { assert(check_index_range(context, index)); if(index < context->hd_table.len) { - return nghttp2_hd_ringbuf_get(&context->hd_table, index); + return hd_ringbuf_get(&context->hd_table, index); } else { return &static_table[static_table_index[index - context->hd_table.len]].ent; @@ -1247,7 +1245,7 @@ int nghttp2_hd_deflate_hd(nghttp2_hd_deflater *deflater, "deflatehd: all input name/value pairs were deflated\n")); for(i = 0; i < deflater->ctx.hd_table.len; ++i) { - nghttp2_hd_entry *ent = nghttp2_hd_ringbuf_get(&deflater->ctx.hd_table, i); + nghttp2_hd_entry *ent = hd_ringbuf_get(&deflater->ctx.hd_table, i); rv = deflate_post_process_hd_entry(ent, i, bufs); if(rv != 0) { @@ -1409,7 +1407,7 @@ static int hd_inflate_commit_indexed(nghttp2_hd_inflater *inflater, } static int hd_inflate_remove_bufs(nghttp2_hd_inflater *inflater, - nghttp2_nv *nv, int value_only) + nghttp2_nv *nv, int value_only) { ssize_t rv; @@ -1904,8 +1902,8 @@ ssize_t nghttp2_hd_inflate_hd(nghttp2_hd_inflater *inflater, for(; inflater->end_headers_index < inflater->ctx.hd_table.len; ++inflater->end_headers_index) { nghttp2_hd_entry *ent; - ent = nghttp2_hd_ringbuf_get(&inflater->ctx.hd_table, - inflater->end_headers_index); + ent = hd_ringbuf_get(&inflater->ctx.hd_table, + inflater->end_headers_index); if((ent->flags & NGHTTP2_HD_FLAG_REFSET) && (ent->flags & NGHTTP2_HD_FLAG_EMIT) == 0) { diff --git a/lib/nghttp2_submit.c b/lib/nghttp2_submit.c index 5769edde..c6c47fab 100644 --- a/lib/nghttp2_submit.c +++ b/lib/nghttp2_submit.c @@ -35,7 +35,7 @@ /* This function takes ownership of |nva_copy|. Regardless of the return value, the caller must not free |nva_copy| after this function returns. */ -static int32_t nghttp2_submit_headers_shared +static int32_t submit_headers_shared (nghttp2_session *session, uint8_t flags, int32_t stream_id, @@ -133,7 +133,7 @@ static void adjust_priority_spec_weight(nghttp2_priority_spec *pri_spec) } } -static int32_t nghttp2_submit_headers_shared_nva +static int32_t submit_headers_shared_nva (nghttp2_session *session, uint8_t flags, int32_t stream_id, @@ -159,9 +159,9 @@ static int32_t nghttp2_submit_headers_shared_nva return rv; } - return nghttp2_submit_headers_shared(session, flags, stream_id, - ©_pri_spec, nva_copy, rv, data_prd, - stream_user_data); + return submit_headers_shared(session, flags, stream_id, + ©_pri_spec, nva_copy, rv, data_prd, + stream_user_data); } int32_t nghttp2_submit_headers(nghttp2_session *session, uint8_t flags, @@ -178,8 +178,8 @@ int32_t nghttp2_submit_headers(nghttp2_session *session, uint8_t flags, pri_spec = NULL; } - return nghttp2_submit_headers_shared_nva(session, flags, stream_id, pri_spec, - nva, nvlen, NULL, stream_user_data); + return submit_headers_shared_nva(session, flags, stream_id, pri_spec, + nva, nvlen, NULL, stream_user_data); } @@ -461,9 +461,9 @@ int32_t nghttp2_submit_request(nghttp2_session *session, flags = set_request_flags(pri_spec, data_prd); - return nghttp2_submit_headers_shared_nva(session, flags, -1, pri_spec, - nva, nvlen, - data_prd, stream_user_data); + return submit_headers_shared_nva(session, flags, -1, pri_spec, + nva, nvlen, + data_prd, stream_user_data); } static uint8_t set_response_flags(const nghttp2_data_provider *data_prd) @@ -481,9 +481,9 @@ int nghttp2_submit_response(nghttp2_session *session, const nghttp2_data_provider *data_prd) { uint8_t flags = set_response_flags(data_prd); - return nghttp2_submit_headers_shared_nva(session, flags, stream_id, - NULL, nva, nvlen, - data_prd, NULL); + return submit_headers_shared_nva(session, flags, stream_id, + NULL, nva, nvlen, + data_prd, NULL); } int nghttp2_submit_data(nghttp2_session *session, uint8_t flags,