fix
This commit is contained in:
parent
360dc19fb0
commit
17c287e5c0
@ -45,7 +45,6 @@ htbuffer_t *htbuffer_init(unsigned int start_size) {
|
|||||||
? (start_size + (DEFAULT_CHUNK_SIZE - start_size % DEFAULT_CHUNK_SIZE))
|
? (start_size + (DEFAULT_CHUNK_SIZE - start_size % DEFAULT_CHUNK_SIZE))
|
||||||
: start_size;
|
: start_size;
|
||||||
|
|
||||||
b->current_fill_size = 0;
|
|
||||||
b->max_size = DEFAULT_MAX_SIZE;
|
b->max_size = DEFAULT_MAX_SIZE;
|
||||||
|
|
||||||
b->buf = (char*) htmalloc(sizeof(char) * b->current_buf_size);
|
b->buf = (char*) htmalloc(sizeof(char) * b->current_buf_size);
|
||||||
@ -65,9 +64,7 @@ void htbuffer_free(htbuffer_t *b) {
|
|||||||
|
|
||||||
|
|
||||||
unsigned int htbuffer_strlen(htbuffer_t *b) {
|
unsigned int htbuffer_strlen(htbuffer_t *b) {
|
||||||
/* 1 because of the terminating \0 */
|
return strlen(b->buf);
|
||||||
assert((b->current_fill_size + 1) == strlen(b->buf));
|
|
||||||
return b->current_fill_size - 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
htbuffer_t *htbuffer_memcpy_w_offset(htbuffer_t *dest, unsigned int offset, const char *src, unsigned int src_size) {
|
htbuffer_t *htbuffer_memcpy_w_offset(htbuffer_t *dest, unsigned int offset, const char *src, unsigned int src_size) {
|
||||||
@ -91,8 +88,6 @@ htbuffer_t *htbuffer_memcpy_w_offset(htbuffer_t *dest, unsigned int offset, cons
|
|||||||
dest->current_buf_size = new_buf_size;
|
dest->current_buf_size = new_buf_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
dest->current_fill_size = src_size + offset;
|
|
||||||
|
|
||||||
memcpy(dest->buf + offset, src, src_size);
|
memcpy(dest->buf + offset, src, src_size);
|
||||||
|
|
||||||
return dest;
|
return dest;
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
typedef struct htbuffer_s {
|
typedef struct htbuffer_s {
|
||||||
char *buf;
|
char *buf;
|
||||||
unsigned int current_buf_size;
|
unsigned int current_buf_size;
|
||||||
unsigned int current_fill_size;
|
|
||||||
unsigned int max_size;
|
unsigned int max_size;
|
||||||
} htbuffer_t;
|
} htbuffer_t;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user