mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 12:23:32 +01:00
When removing all bytes from a buffer, reset buf->cur=buf->mem
svn:r4166
This commit is contained in:
parent
a312ce1d3b
commit
d6a6c8785b
@ -267,7 +267,11 @@ buf_shrink(buf_t *buf)
|
||||
static INLINE void buf_remove_from_front(buf_t *buf, size_t n) {
|
||||
tor_assert(buf->datalen >= n);
|
||||
buf->datalen -= n;
|
||||
buf->cur = _wrap_ptr(buf, buf->cur+n);
|
||||
if (buf->datalen) {
|
||||
buf->cur = _wrap_ptr(buf, buf->cur+n);
|
||||
} else {
|
||||
buf->cur = buf->mem;
|
||||
}
|
||||
buf_shrink_if_underfull(buf);
|
||||
check();
|
||||
}
|
||||
|
@ -1127,7 +1127,6 @@ void buf_shrink(buf_t *buf);
|
||||
|
||||
size_t buf_datalen(const buf_t *buf);
|
||||
size_t buf_capacity(const buf_t *buf);
|
||||
unsigned int buf_n_times_resized(const buf_t *buf);
|
||||
const char *_buf_peek_raw_buffer(const buf_t *buf);
|
||||
|
||||
int read_to_buf(int s, size_t at_most, buf_t *buf, int *reached_eof);
|
||||
|
Loading…
Reference in New Issue
Block a user