Commit 3ebb3faf authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

Remove nghttp2_ prefix from static function, part 2

parent 65bbdf56
...@@ -96,8 +96,7 @@ void nghttp2_buf_wrap_init(nghttp2_buf *buf, uint8_t *begin, size_t len) ...@@ -96,8 +96,7 @@ void nghttp2_buf_wrap_init(nghttp2_buf *buf, uint8_t *begin, size_t len)
buf->end = begin + len; buf->end = begin + len;
} }
static int nghttp2_buf_chain_new(nghttp2_buf_chain **chain, static int buf_chain_new(nghttp2_buf_chain **chain, size_t chunk_length)
size_t chunk_length)
{ {
int rv; int rv;
...@@ -117,7 +116,7 @@ static int nghttp2_buf_chain_new(nghttp2_buf_chain **chain, ...@@ -117,7 +116,7 @@ static int nghttp2_buf_chain_new(nghttp2_buf_chain **chain,
return 0; 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); nghttp2_buf_free(&chain->buf);
free(chain); free(chain);
...@@ -145,7 +144,7 @@ int nghttp2_bufs_init3(nghttp2_bufs *bufs, size_t chunk_length, ...@@ -145,7 +144,7 @@ int nghttp2_bufs_init3(nghttp2_bufs *bufs, size_t chunk_length,
return NGHTTP2_ERR_INVALID_ARGUMENT; return NGHTTP2_ERR_INVALID_ARGUMENT;
} }
rv = nghttp2_buf_chain_new(&chain, chunk_length); rv = buf_chain_new(&chain, chunk_length);
if(rv != 0) { if(rv != 0) {
return rv; return rv;
} }
...@@ -172,7 +171,7 @@ void nghttp2_bufs_free(nghttp2_bufs *bufs) ...@@ -172,7 +171,7 @@ void nghttp2_bufs_free(nghttp2_bufs *bufs)
for(chain = bufs->head; chain;) { for(chain = bufs->head; chain;) {
next_chain = chain->next; next_chain = chain->next;
nghttp2_buf_chain_del(chain); buf_chain_del(chain);
chain = next_chain; chain = next_chain;
} }
...@@ -204,13 +203,13 @@ ssize_t nghttp2_bufs_len(nghttp2_bufs *bufs) ...@@ -204,13 +203,13 @@ ssize_t nghttp2_bufs_len(nghttp2_bufs *bufs)
return len; return len;
} }
static int nghttp2_bufs_avail(nghttp2_bufs *bufs) static int bufs_avail(nghttp2_bufs *bufs)
{ {
return nghttp2_buf_avail(&bufs->cur->buf) + return nghttp2_buf_avail(&bufs->cur->buf) +
(bufs->chunk_length - bufs->offset) * (bufs->max_chunk - bufs->chunk_used); (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; int rv;
nghttp2_buf_chain *chain; nghttp2_buf_chain *chain;
...@@ -225,7 +224,7 @@ static int nghttp2_bufs_alloc_chain(nghttp2_bufs *bufs) ...@@ -225,7 +224,7 @@ static int nghttp2_bufs_alloc_chain(nghttp2_bufs *bufs)
return NGHTTP2_ERR_BUFFER_ERROR; 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) { if(rv != 0) {
return rv; return rv;
} }
...@@ -251,7 +250,7 @@ int nghttp2_bufs_add(nghttp2_bufs *bufs, const void *data, size_t len) ...@@ -251,7 +250,7 @@ int nghttp2_bufs_add(nghttp2_bufs *bufs, const void *data, size_t len)
nghttp2_buf *buf; nghttp2_buf *buf;
const uint8_t *p; const uint8_t *p;
if(nghttp2_bufs_avail(bufs) < (ssize_t)len) { if(bufs_avail(bufs) < (ssize_t)len) {
return NGHTTP2_ERR_BUFFER_ERROR; return NGHTTP2_ERR_BUFFER_ERROR;
} }
...@@ -262,7 +261,7 @@ int nghttp2_bufs_add(nghttp2_bufs *bufs, const void *data, size_t len) ...@@ -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); nwrite = nghttp2_min((size_t)nghttp2_buf_avail(buf), len);
if(nwrite == 0) { if(nwrite == 0) {
rv = nghttp2_bufs_alloc_chain(bufs); rv = bufs_alloc_chain(bufs);
if(rv != 0) { if(rv != 0) {
return rv; return rv;
} }
...@@ -277,7 +276,7 @@ int nghttp2_bufs_add(nghttp2_bufs *bufs, const void *data, size_t len) ...@@ -277,7 +276,7 @@ int nghttp2_bufs_add(nghttp2_bufs *bufs, const void *data, size_t len)
return 0; return 0;
} }
static int nghttp2_bufs_ensure_addb(nghttp2_bufs *bufs) static int bufs_ensure_addb(nghttp2_bufs *bufs)
{ {
int rv; int rv;
nghttp2_buf *buf; nghttp2_buf *buf;
...@@ -288,7 +287,7 @@ static int nghttp2_bufs_ensure_addb(nghttp2_bufs *bufs) ...@@ -288,7 +287,7 @@ static int nghttp2_bufs_ensure_addb(nghttp2_bufs *bufs)
return 0; return 0;
} }
rv = nghttp2_bufs_alloc_chain(bufs); rv = bufs_alloc_chain(bufs);
if(rv != 0) { if(rv != 0) {
return rv; return rv;
} }
...@@ -300,7 +299,7 @@ int nghttp2_bufs_addb(nghttp2_bufs *bufs, uint8_t b) ...@@ -300,7 +299,7 @@ int nghttp2_bufs_addb(nghttp2_bufs *bufs, uint8_t b)
{ {
int rv; int rv;
rv = nghttp2_bufs_ensure_addb(bufs); rv = bufs_ensure_addb(bufs);
if(rv != 0) { if(rv != 0) {
return rv; return rv;
} }
...@@ -314,7 +313,7 @@ int nghttp2_bufs_addb_hold(nghttp2_bufs *bufs, uint8_t b) ...@@ -314,7 +313,7 @@ int nghttp2_bufs_addb_hold(nghttp2_bufs *bufs, uint8_t b)
{ {
int rv; int rv;
rv = nghttp2_bufs_ensure_addb(bufs); rv = bufs_ensure_addb(bufs);
if(rv != 0) { if(rv != 0) {
return rv; return rv;
} }
...@@ -328,7 +327,7 @@ int nghttp2_bufs_orb(nghttp2_bufs *bufs, uint8_t b) ...@@ -328,7 +327,7 @@ int nghttp2_bufs_orb(nghttp2_bufs *bufs, uint8_t b)
{ {
int rv; int rv;
rv = nghttp2_bufs_ensure_addb(bufs); rv = bufs_ensure_addb(bufs);
if(rv != 0) { if(rv != 0) {
return rv; return rv;
} }
...@@ -342,7 +341,7 @@ int nghttp2_bufs_orb_hold(nghttp2_bufs *bufs, uint8_t b) ...@@ -342,7 +341,7 @@ int nghttp2_bufs_orb_hold(nghttp2_bufs *bufs, uint8_t b)
{ {
int rv; int rv;
rv = nghttp2_bufs_ensure_addb(bufs); rv = bufs_ensure_addb(bufs);
if(rv != 0) { if(rv != 0) {
return rv; return rv;
} }
...@@ -416,7 +415,7 @@ void nghttp2_bufs_reset(nghttp2_bufs *bufs) ...@@ -416,7 +415,7 @@ void nghttp2_bufs_reset(nghttp2_bufs *bufs)
for(ci = chain; ci;) { for(ci = chain; ci;) {
chain = ci->next; chain = ci->next;
nghttp2_buf_chain_del(ci); buf_chain_del(ci);
ci = chain; ci = chain;
} }
...@@ -429,7 +428,7 @@ void nghttp2_bufs_reset(nghttp2_bufs *bufs) ...@@ -429,7 +428,7 @@ void nghttp2_bufs_reset(nghttp2_bufs *bufs)
int nghttp2_bufs_advance(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) int nghttp2_bufs_next_present(nghttp2_bufs *bufs)
......
...@@ -54,7 +54,7 @@ void nghttp2_frame_unpack_frame_hd(nghttp2_frame_hd *hd, const uint8_t* buf) ...@@ -54,7 +54,7 @@ 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; 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, static void frame_set_hd(nghttp2_frame_hd *hd, uint16_t length,
uint8_t type, uint8_t flags, uint8_t type, uint8_t flags,
int32_t stream_id) int32_t stream_id)
{ {
...@@ -70,7 +70,7 @@ void nghttp2_frame_headers_init(nghttp2_headers *frame, ...@@ -70,7 +70,7 @@ void nghttp2_frame_headers_init(nghttp2_headers *frame,
const nghttp2_priority_spec *pri_spec, const nghttp2_priority_spec *pri_spec,
nghttp2_nv *nva, size_t nvlen) 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->padlen = 0;
frame->nva = nva; frame->nva = nva;
frame->nvlen = nvlen; frame->nvlen = nvlen;
...@@ -91,7 +91,7 @@ void nghttp2_frame_headers_free(nghttp2_headers *frame) ...@@ -91,7 +91,7 @@ void nghttp2_frame_headers_free(nghttp2_headers *frame)
void nghttp2_frame_priority_init(nghttp2_priority *frame, int32_t stream_id, void nghttp2_frame_priority_init(nghttp2_priority *frame, int32_t stream_id,
const nghttp2_priority_spec *pri_spec) const nghttp2_priority_spec *pri_spec)
{ {
nghttp2_frame_set_hd(&frame->hd, 5, NGHTTP2_PRIORITY, NGHTTP2_FLAG_NONE, frame_set_hd(&frame->hd, 5, NGHTTP2_PRIORITY, NGHTTP2_FLAG_NONE,
stream_id); stream_id);
frame->pri_spec = *pri_spec; frame->pri_spec = *pri_spec;
} }
...@@ -103,7 +103,7 @@ void nghttp2_frame_rst_stream_init(nghttp2_rst_stream *frame, ...@@ -103,7 +103,7 @@ void nghttp2_frame_rst_stream_init(nghttp2_rst_stream *frame,
int32_t stream_id, int32_t stream_id,
nghttp2_error_code error_code) nghttp2_error_code error_code)
{ {
nghttp2_frame_set_hd(&frame->hd, 4, NGHTTP2_RST_STREAM, NGHTTP2_FLAG_NONE, frame_set_hd(&frame->hd, 4, NGHTTP2_RST_STREAM, NGHTTP2_FLAG_NONE,
stream_id); stream_id);
frame->error_code = error_code; frame->error_code = error_code;
} }
...@@ -115,7 +115,7 @@ void nghttp2_frame_rst_stream_free(nghttp2_rst_stream *frame) ...@@ -115,7 +115,7 @@ void nghttp2_frame_rst_stream_free(nghttp2_rst_stream *frame)
void nghttp2_frame_settings_init(nghttp2_settings *frame, uint8_t flags, void nghttp2_frame_settings_init(nghttp2_settings *frame, uint8_t flags,
nghttp2_settings_entry *iv, size_t niv) nghttp2_settings_entry *iv, size_t niv)
{ {
nghttp2_frame_set_hd(&frame->hd, niv * NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH, frame_set_hd(&frame->hd, niv * NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH,
NGHTTP2_SETTINGS, flags, 0); NGHTTP2_SETTINGS, flags, 0);
frame->niv = niv; frame->niv = niv;
frame->iv = iv; frame->iv = iv;
...@@ -131,7 +131,7 @@ void nghttp2_frame_push_promise_init(nghttp2_push_promise *frame, ...@@ -131,7 +131,7 @@ void nghttp2_frame_push_promise_init(nghttp2_push_promise *frame,
int32_t promised_stream_id, int32_t promised_stream_id,
nghttp2_nv *nva, size_t nvlen) 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->padlen = 0;
frame->nva = nva; frame->nva = nva;
frame->nvlen = nvlen; frame->nvlen = nvlen;
...@@ -146,7 +146,7 @@ void nghttp2_frame_push_promise_free(nghttp2_push_promise *frame) ...@@ -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, void nghttp2_frame_ping_init(nghttp2_ping *frame, uint8_t flags,
const uint8_t *opaque_data) 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) { if(opaque_data) {
memcpy(frame->opaque_data, opaque_data, sizeof(frame->opaque_data)); memcpy(frame->opaque_data, opaque_data, sizeof(frame->opaque_data));
} else { } else {
...@@ -161,7 +161,7 @@ void nghttp2_frame_goaway_init(nghttp2_goaway *frame, int32_t last_stream_id, ...@@ -161,7 +161,7 @@ void nghttp2_frame_goaway_init(nghttp2_goaway *frame, int32_t last_stream_id,
nghttp2_error_code error_code, nghttp2_error_code error_code,
uint8_t *opaque_data, size_t opaque_data_len) uint8_t *opaque_data, size_t opaque_data_len)
{ {
nghttp2_frame_set_hd(&frame->hd, 8+opaque_data_len, NGHTTP2_GOAWAY, frame_set_hd(&frame->hd, 8+opaque_data_len, NGHTTP2_GOAWAY,
NGHTTP2_FLAG_NONE, 0); NGHTTP2_FLAG_NONE, 0);
frame->last_stream_id = last_stream_id; frame->last_stream_id = last_stream_id;
frame->error_code = error_code; frame->error_code = error_code;
...@@ -179,7 +179,7 @@ void nghttp2_frame_window_update_init(nghttp2_window_update *frame, ...@@ -179,7 +179,7 @@ void nghttp2_frame_window_update_init(nghttp2_window_update *frame,
int32_t stream_id, int32_t stream_id,
int32_t window_size_increment) 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; frame->window_size_increment = window_size_increment;
} }
...@@ -199,8 +199,8 @@ void nghttp2_frame_altsvc_init(nghttp2_altsvc *frame, int32_t stream_id, ...@@ -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. */ /* 8 for Max-Age, Port, Reserved and PID_LEN. 1 for HOST_LEN. */
payloadlen = 8 + protocol_id_len + 1 + host_len + origin_len; payloadlen = 8 + protocol_id_len + 1 + host_len + origin_len;
nghttp2_frame_set_hd(&frame->hd, payloadlen, NGHTTP2_ALTSVC, frame_set_hd(&frame->hd, payloadlen, NGHTTP2_ALTSVC, NGHTTP2_FLAG_NONE,
NGHTTP2_FLAG_NONE, stream_id); stream_id);
frame->max_age = max_age; frame->max_age = max_age;
frame->port = port; frame->port = port;
...@@ -219,7 +219,7 @@ void nghttp2_frame_altsvc_free(nghttp2_altsvc *frame) ...@@ -219,7 +219,7 @@ void nghttp2_frame_altsvc_free(nghttp2_altsvc *frame)
void nghttp2_frame_blocked_init(nghttp2_blocked *frame, int32_t stream_id) void nghttp2_frame_blocked_init(nghttp2_blocked *frame, int32_t stream_id)
{ {
nghttp2_frame_set_hd(&frame->hd, 0, NGHTTP2_BLOCKED, NGHTTP2_FLAG_NONE, frame_set_hd(&frame->hd, 0, NGHTTP2_BLOCKED, NGHTTP2_FLAG_NONE,
stream_id); stream_id);
} }
...@@ -251,7 +251,7 @@ void nghttp2_frame_private_data_init(nghttp2_private_data *frame, ...@@ -251,7 +251,7 @@ void nghttp2_frame_private_data_init(nghttp2_private_data *frame,
const nghttp2_data_provider *data_prd) const nghttp2_data_provider *data_prd)
{ {
/* At this moment, the length of DATA frame is unknown */ /* 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->data_prd = *data_prd;
frame->padlen = 0; frame->padlen = 0;
frame->eof = 0; frame->eof = 0;
......
This diff is collapsed.
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
/* This function takes ownership of |nva_copy|. Regardless of the /* This function takes ownership of |nva_copy|. Regardless of the
return value, the caller must not free |nva_copy| after this return value, the caller must not free |nva_copy| after this
function returns. */ function returns. */
static int32_t nghttp2_submit_headers_shared static int32_t submit_headers_shared
(nghttp2_session *session, (nghttp2_session *session,
uint8_t flags, uint8_t flags,
int32_t stream_id, int32_t stream_id,
...@@ -133,7 +133,7 @@ static void adjust_priority_spec_weight(nghttp2_priority_spec *pri_spec) ...@@ -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, (nghttp2_session *session,
uint8_t flags, uint8_t flags,
int32_t stream_id, int32_t stream_id,
...@@ -159,7 +159,7 @@ static int32_t nghttp2_submit_headers_shared_nva ...@@ -159,7 +159,7 @@ static int32_t nghttp2_submit_headers_shared_nva
return rv; return rv;
} }
return nghttp2_submit_headers_shared(session, flags, stream_id, return submit_headers_shared(session, flags, stream_id,
&copy_pri_spec, nva_copy, rv, data_prd, &copy_pri_spec, nva_copy, rv, data_prd,
stream_user_data); stream_user_data);
} }
...@@ -178,7 +178,7 @@ int32_t nghttp2_submit_headers(nghttp2_session *session, uint8_t flags, ...@@ -178,7 +178,7 @@ int32_t nghttp2_submit_headers(nghttp2_session *session, uint8_t flags,
pri_spec = NULL; pri_spec = NULL;
} }
return nghttp2_submit_headers_shared_nva(session, flags, stream_id, pri_spec, return submit_headers_shared_nva(session, flags, stream_id, pri_spec,
nva, nvlen, NULL, stream_user_data); nva, nvlen, NULL, stream_user_data);
} }
...@@ -461,7 +461,7 @@ int32_t nghttp2_submit_request(nghttp2_session *session, ...@@ -461,7 +461,7 @@ int32_t nghttp2_submit_request(nghttp2_session *session,
flags = set_request_flags(pri_spec, data_prd); flags = set_request_flags(pri_spec, data_prd);
return nghttp2_submit_headers_shared_nva(session, flags, -1, pri_spec, return submit_headers_shared_nva(session, flags, -1, pri_spec,
nva, nvlen, nva, nvlen,
data_prd, stream_user_data); data_prd, stream_user_data);
} }
...@@ -481,7 +481,7 @@ int nghttp2_submit_response(nghttp2_session *session, ...@@ -481,7 +481,7 @@ int nghttp2_submit_response(nghttp2_session *session,
const nghttp2_data_provider *data_prd) const nghttp2_data_provider *data_prd)
{ {
uint8_t flags = set_response_flags(data_prd); uint8_t flags = set_response_flags(data_prd);
return nghttp2_submit_headers_shared_nva(session, flags, stream_id, return submit_headers_shared_nva(session, flags, stream_id,
NULL, nva, nvlen, NULL, nva, nvlen,
data_prd, NULL); data_prd, NULL);
} }
......
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