nghttp2_pq_init never fail

This commit is contained in:
Tatsuhiro Tsujikawa 2022-06-11 17:36:48 +09:00
parent ac3f846f29
commit 4ffb63a737
3 changed files with 3 additions and 14 deletions

View File

@ -29,13 +29,12 @@
#include "nghttp2_helper.h"
int nghttp2_pq_init(nghttp2_pq *pq, nghttp2_less less, nghttp2_mem *mem) {
void nghttp2_pq_init(nghttp2_pq *pq, nghttp2_less less, nghttp2_mem *mem) {
pq->mem = mem;
pq->capacity = 0;
pq->q = NULL;
pq->length = 0;
pq->less = less;
return 0;
}
void nghttp2_pq_free(nghttp2_pq *pq) {

View File

@ -55,14 +55,8 @@ typedef struct {
/*
* Initializes priority queue |pq| with compare function |cmp|.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
*
* NGHTTP2_ERR_NOMEM
* Out of memory.
*/
int nghttp2_pq_init(nghttp2_pq *pq, nghttp2_less less, nghttp2_mem *mem);
void nghttp2_pq_init(nghttp2_pq *pq, nghttp2_less less, nghttp2_mem *mem);
/*
* Deallocates any resources allocated for |pq|. The stored items are

View File

@ -595,11 +595,7 @@ static int session_new(nghttp2_session **session_ptr,
}
}
rv = nghttp2_pq_init(&(*session_ptr)->ob_data, stream_less, mem);
if (rv != 0) {
assert(0);
abort();
}
nghttp2_pq_init(&(*session_ptr)->ob_data, stream_less, mem);
return 0;