Remove unused functions
This commit is contained in:
parent
7d282cd0bd
commit
76800dc8e7
|
@ -80,16 +80,6 @@ int nghttp2_buf_reserve(nghttp2_buf *buf, size_t new_cap)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nghttp2_buf_pos_reserve(nghttp2_buf *buf, size_t new_rel_cap)
|
|
||||||
{
|
|
||||||
return nghttp2_buf_reserve(buf, nghttp2_buf_pos_offset(buf) + new_rel_cap);
|
|
||||||
}
|
|
||||||
|
|
||||||
int nghttp2_buf_last_reserve(nghttp2_buf *buf, size_t new_rel_cap)
|
|
||||||
{
|
|
||||||
return nghttp2_buf_reserve(buf, nghttp2_buf_last_offset(buf) + new_rel_cap);
|
|
||||||
}
|
|
||||||
|
|
||||||
void nghttp2_buf_reset(nghttp2_buf *buf)
|
void nghttp2_buf_reset(nghttp2_buf *buf)
|
||||||
{
|
{
|
||||||
buf->pos = buf->last = buf->mark = buf->begin;
|
buf->pos = buf->last = buf->mark = buf->begin;
|
||||||
|
|
|
@ -107,22 +107,6 @@ void nghttp2_buf_free(nghttp2_buf *buf);
|
||||||
*/
|
*/
|
||||||
int nghttp2_buf_reserve(nghttp2_buf *buf, size_t new_cap);
|
int nghttp2_buf_reserve(nghttp2_buf *buf, size_t new_cap);
|
||||||
|
|
||||||
/*
|
|
||||||
* This function behaves like nghttp2_buf_reserve(), but new capacity
|
|
||||||
* is calculated as nghttp2_buf_pos_offset(buf) + new_rel_cap. In
|
|
||||||
* other words, this function reserves memory at least |new_rel_cap|
|
|
||||||
* bytes from buf->pos.
|
|
||||||
*/
|
|
||||||
int nghttp2_buf_pos_reserve(nghttp2_buf *buf, size_t new_rel_cap);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This function behaves like nghttp2_buf_reserve(), but new capacity
|
|
||||||
* is calculated as nghttp2_buf_last_offset(buf) + new_rel_cap. In
|
|
||||||
* other words, this function reserves memory at least |new_rel_cap|
|
|
||||||
* bytes from buf->last.
|
|
||||||
*/
|
|
||||||
int nghttp2_buf_last_reserve(nghttp2_buf *buf, size_t new_rel_cap);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Resets pos, last, mark member of |buf| to buf->begin.
|
* Resets pos, last, mark member of |buf| to buf->begin.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -55,23 +55,6 @@ uint32_t nghttp2_get_uint32(const uint8_t *data)
|
||||||
return ntohl(n);
|
return ntohl(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
int nghttp2_reserve_buffer(uint8_t **buf_ptr, size_t *buflen_ptr,
|
|
||||||
size_t min_length)
|
|
||||||
{
|
|
||||||
if(min_length > *buflen_ptr) {
|
|
||||||
uint8_t *temp;
|
|
||||||
min_length = (min_length+4095)/4096*4096;
|
|
||||||
temp = realloc(*buf_ptr, min_length);
|
|
||||||
if(temp == NULL) {
|
|
||||||
return NGHTTP2_ERR_NOMEM;
|
|
||||||
} else {
|
|
||||||
*buf_ptr = temp;
|
|
||||||
*buflen_ptr = min_length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void* nghttp2_memdup(const void* src, size_t n)
|
void* nghttp2_memdup(const void* src, size_t n)
|
||||||
{
|
{
|
||||||
void* dest;
|
void* dest;
|
||||||
|
|
|
@ -58,25 +58,6 @@ uint16_t nghttp2_get_uint16(const uint8_t *data);
|
||||||
*/
|
*/
|
||||||
uint32_t nghttp2_get_uint32(const uint8_t *data);
|
uint32_t nghttp2_get_uint32(const uint8_t *data);
|
||||||
|
|
||||||
/*
|
|
||||||
* Ensures that buffer |*buf_ptr| with |*buflen_ptr| length has at
|
|
||||||
* least |min_length| bytes. If |min_length| > |*buflen_ptr|,
|
|
||||||
* allocates new buffer having at least |min_length| bytes and assigns
|
|
||||||
* its pointer to |*buf_ptr| and allocated number of bytes to
|
|
||||||
* |*buflen_ptr|. The memory pointed by |*buf_ptr| previously may
|
|
||||||
* change. No memory copy is done between old and new buffer.
|
|
||||||
* |*buf_ptr| and |*buflen_ptr| are only updated iff this function
|
|
||||||
* succeeds.
|
|
||||||
*
|
|
||||||
* This function returns 0 if it succeeds, or one of the following
|
|
||||||
* negative error codes:
|
|
||||||
*
|
|
||||||
* NGHTTP2_ERR_NOMEM
|
|
||||||
* Out of memory.
|
|
||||||
*/
|
|
||||||
int nghttp2_reserve_buffer(uint8_t **buf_ptr, size_t *buflen_ptr,
|
|
||||||
size_t min_length);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allocates |n| bytes of memory and copy the memory region pointed by
|
* Allocates |n| bytes of memory and copy the memory region pointed by
|
||||||
* |src| with the length |n| bytes into it. Returns the allocated memory.
|
* |src| with the length |n| bytes into it. Returns the allocated memory.
|
||||||
|
|
|
@ -317,8 +317,6 @@ int main(int argc, char* argv[])
|
||||||
!CU_add_test(pSuite, "bufs_remove", test_nghttp2_bufs_remove) ||
|
!CU_add_test(pSuite, "bufs_remove", test_nghttp2_bufs_remove) ||
|
||||||
!CU_add_test(pSuite, "bufs_reset", test_nghttp2_bufs_reset) ||
|
!CU_add_test(pSuite, "bufs_reset", test_nghttp2_bufs_reset) ||
|
||||||
!CU_add_test(pSuite, "bufs_advance", test_nghttp2_bufs_advance) ||
|
!CU_add_test(pSuite, "bufs_advance", test_nghttp2_bufs_advance) ||
|
||||||
!CU_add_test(pSuite, "bufs_seek_present",
|
|
||||||
test_nghttp2_bufs_seek_last_present) ||
|
|
||||||
!CU_add_test(pSuite, "bufs_next_present",
|
!CU_add_test(pSuite, "bufs_next_present",
|
||||||
test_nghttp2_bufs_next_present) ||
|
test_nghttp2_bufs_next_present) ||
|
||||||
!CU_add_test(pSuite, "bufs_realloc", test_nghttp2_bufs_realloc)
|
!CU_add_test(pSuite, "bufs_realloc", test_nghttp2_bufs_realloc)
|
||||||
|
|
|
@ -253,42 +253,6 @@ void test_nghttp2_bufs_advance(void)
|
||||||
nghttp2_bufs_free(&bufs);
|
nghttp2_bufs_free(&bufs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_nghttp2_bufs_seek_last_present(void)
|
|
||||||
{
|
|
||||||
int rv;
|
|
||||||
nghttp2_bufs bufs;
|
|
||||||
|
|
||||||
rv = nghttp2_bufs_init(&bufs, 250, 3);
|
|
||||||
CU_ASSERT(0 == rv);
|
|
||||||
|
|
||||||
rv = nghttp2_bufs_advance(&bufs);
|
|
||||||
CU_ASSERT(0 == rv);
|
|
||||||
|
|
||||||
rv = nghttp2_bufs_addb(&bufs, 5);
|
|
||||||
CU_ASSERT(0 == rv);
|
|
||||||
|
|
||||||
bufs.cur = bufs.head;
|
|
||||||
|
|
||||||
/* cur is unchanged because cur is empty */
|
|
||||||
nghttp2_bufs_seek_last_present(&bufs);
|
|
||||||
|
|
||||||
CU_ASSERT(bufs.cur == bufs.head);
|
|
||||||
|
|
||||||
rv = nghttp2_bufs_addb(&bufs, 1);
|
|
||||||
CU_ASSERT(0 == rv);
|
|
||||||
|
|
||||||
nghttp2_bufs_seek_last_present(&bufs);
|
|
||||||
|
|
||||||
CU_ASSERT(bufs.cur == bufs.head->next);
|
|
||||||
|
|
||||||
/* cur is unchanged */
|
|
||||||
nghttp2_bufs_seek_last_present(&bufs);
|
|
||||||
|
|
||||||
CU_ASSERT(bufs.cur == bufs.head->next);
|
|
||||||
|
|
||||||
nghttp2_bufs_free(&bufs);
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_nghttp2_bufs_next_present(void)
|
void test_nghttp2_bufs_next_present(void)
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
|
|
|
@ -31,7 +31,6 @@ void test_nghttp2_bufs_orb(void);
|
||||||
void test_nghttp2_bufs_remove(void);
|
void test_nghttp2_bufs_remove(void);
|
||||||
void test_nghttp2_bufs_reset(void);
|
void test_nghttp2_bufs_reset(void);
|
||||||
void test_nghttp2_bufs_advance(void);
|
void test_nghttp2_bufs_advance(void);
|
||||||
void test_nghttp2_bufs_seek_last_present(void);
|
|
||||||
void test_nghttp2_bufs_next_present(void);
|
void test_nghttp2_bufs_next_present(void);
|
||||||
void test_nghttp2_bufs_realloc(void);
|
void test_nghttp2_bufs_realloc(void);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue