Fix compile error with --enable-werror

This commit is contained in:
Tatsuhiro Tsujikawa 2015-04-25 02:23:01 +09:00
parent e38dd37667
commit c41f413978
6 changed files with 34 additions and 35 deletions

View File

@ -25,6 +25,15 @@
#include "nghttp2_outbound_item.h"
#include <assert.h>
#include <string.h>
void nghttp2_outbound_item_init(nghttp2_outbound_item *item) {
item->cycle = 0;
item->qnext = NULL;
item->queued = 0;
memset(&item->aux_data, 0, sizeof(nghttp2_aux_data));
}
void nghttp2_outbound_item_free(nghttp2_outbound_item *item, nghttp2_mem *mem) {
nghttp2_frame *frame;

View File

@ -116,6 +116,13 @@ struct nghttp2_outbound_item {
uint8_t queued;
};
/*
* Initializes |item|. No memory allocation is done in this function.
* Don't call nghttp2_outbound_item_free() until frame member is
* initialized.
*/
void nghttp2_outbound_item_init(nghttp2_outbound_item *item);
/*
* Deallocates resource for |item|. If |item| is NULL, this function
* does nothing.

View File

@ -678,15 +678,6 @@ nghttp2_session_reprioritize_stream(nghttp2_session *session,
return 0;
}
void nghttp2_session_outbound_item_init(nghttp2_session *session,
nghttp2_outbound_item *item) {
item->cycle = 0;
item->qnext = NULL;
item->queued = 0;
memset(&item->aux_data, 0, sizeof(nghttp2_aux_data));
}
int nghttp2_session_add_item(nghttp2_session *session,
nghttp2_outbound_item *item) {
/* TODO Return error if stream is not found for the frame requiring
@ -820,7 +811,7 @@ int nghttp2_session_add_rst_stream(nghttp2_session *session, int32_t stream_id,
return NGHTTP2_ERR_NOMEM;
}
nghttp2_session_outbound_item_init(session, item);
nghttp2_outbound_item_init(item);
frame = &item->frame;
@ -5955,7 +5946,7 @@ int nghttp2_session_add_ping(nghttp2_session *session, uint8_t flags,
return NGHTTP2_ERR_NOMEM;
}
nghttp2_session_outbound_item_init(session, item);
nghttp2_outbound_item_init(item);
frame = &item->frame;
@ -6004,7 +5995,7 @@ int nghttp2_session_add_goaway(nghttp2_session *session, int32_t last_stream_id,
return NGHTTP2_ERR_NOMEM;
}
nghttp2_session_outbound_item_init(session, item);
nghttp2_outbound_item_init(item);
frame = &item->frame;
@ -6041,7 +6032,7 @@ int nghttp2_session_add_window_update(nghttp2_session *session, uint8_t flags,
return NGHTTP2_ERR_NOMEM;
}
nghttp2_session_outbound_item_init(session, item);
nghttp2_outbound_item_init(item);
frame = &item->frame;
@ -6112,7 +6103,7 @@ int nghttp2_session_add_settings(nghttp2_session *session, uint8_t flags,
session->inflight_niv = niv;
}
nghttp2_session_outbound_item_init(session, item);
nghttp2_outbound_item_init(item);
frame = &item->frame;

View File

@ -280,14 +280,6 @@ typedef struct {
int nghttp2_session_is_my_stream_id(nghttp2_session *session,
int32_t stream_id);
/*
* Initializes |item|. No memory allocation is done in this function.
* Don't call nghttp2_outbound_item_free() until frame member is
* initialized.
*/
void nghttp2_session_outbound_item_init(nghttp2_session *session,
nghttp2_outbound_item *item);
/*
* Adds |item| to the outbound queue in |session|. When this function
* succeeds, it takes ownership of |item|. So caller must not free it

View File

@ -62,7 +62,7 @@ static int32_t submit_headers_shared(nghttp2_session *session, uint8_t flags,
goto fail;
}
nghttp2_session_outbound_item_init(session, item);
nghttp2_outbound_item_init(item);
if (data_prd != NULL && data_prd->read_callback != NULL) {
item->aux_data.headers.data_prd = *data_prd;
@ -212,7 +212,7 @@ int nghttp2_submit_priority(nghttp2_session *session, uint8_t flags _U_,
return NGHTTP2_ERR_NOMEM;
}
nghttp2_session_outbound_item_init(session, item);
nghttp2_outbound_item_init(item);
frame = &item->frame;
@ -299,7 +299,7 @@ int32_t nghttp2_submit_push_promise(nghttp2_session *session, uint8_t flags _U_,
return NGHTTP2_ERR_NOMEM;
}
nghttp2_session_outbound_item_init(session, item);
nghttp2_outbound_item_init(item);
item->aux_data.headers.stream_user_data = promised_stream_user_data;
@ -453,7 +453,7 @@ int nghttp2_submit_data(nghttp2_session *session, uint8_t flags,
return NGHTTP2_ERR_NOMEM;
}
nghttp2_session_outbound_item_init(session, item);
nghttp2_outbound_item_init(item);
frame = &item->frame;
aux_data = &item->aux_data.data;

View File

@ -1627,7 +1627,7 @@ void test_nghttp2_session_add_frame(void) {
item = mem->malloc(sizeof(nghttp2_outbound_item), NULL);
nghttp2_session_outbound_item_init(session, item);
nghttp2_outbound_item_init(item);
frame = &item->frame;
@ -2698,7 +2698,7 @@ void test_nghttp2_session_send_headers_start_stream(void) {
item = mem->malloc(sizeof(nghttp2_outbound_item), NULL);
nghttp2_session_outbound_item_init(session, item);
nghttp2_outbound_item_init(item);
frame = &item->frame;
@ -2734,7 +2734,7 @@ void test_nghttp2_session_send_headers_reply(void) {
item = mem->malloc(sizeof(nghttp2_outbound_item), NULL);
nghttp2_session_outbound_item_init(session, item);
nghttp2_outbound_item_init(item);
frame = &item->frame;
@ -2784,7 +2784,7 @@ void test_nghttp2_session_send_headers_frame_size_error(void) {
item = mem->malloc(sizeof(nghttp2_outbound_item), NULL);
nghttp2_session_outbound_item_init(session, item);
nghttp2_outbound_item_init(item);
frame = &item->frame;
@ -2829,7 +2829,7 @@ void test_nghttp2_session_send_headers_push_reply(void) {
item = mem->malloc(sizeof(nghttp2_outbound_item), NULL);
nghttp2_session_outbound_item_init(session, item);
nghttp2_outbound_item_init(item);
frame = &item->frame;
@ -2863,7 +2863,7 @@ void test_nghttp2_session_send_rst_stream(void) {
item = mem->malloc(sizeof(nghttp2_outbound_item), NULL);
nghttp2_session_outbound_item_init(session, item);
nghttp2_outbound_item_init(item);
frame = &item->frame;
@ -2897,7 +2897,7 @@ void test_nghttp2_session_send_push_promise(void) {
item = mem->malloc(sizeof(nghttp2_outbound_item), NULL);
nghttp2_session_outbound_item_init(session, item);
nghttp2_outbound_item_init(item);
frame = &item->frame;
@ -2925,7 +2925,7 @@ void test_nghttp2_session_send_push_promise(void) {
item = mem->malloc(sizeof(nghttp2_outbound_item), NULL);
nghttp2_session_outbound_item_init(session, item);
nghttp2_outbound_item_init(item);
frame = &item->frame;
@ -2948,7 +2948,7 @@ void test_nghttp2_session_send_push_promise(void) {
&pri_spec_default, NGHTTP2_STREAM_OPENING, NULL);
item = mem->malloc(sizeof(nghttp2_outbound_item), NULL);
nghttp2_session_outbound_item_init(session, item);
nghttp2_outbound_item_init(item);
frame = &item->frame;