New upstream version 21.0.2+dfsg1

This commit is contained in:
Sebastian Ramacher 2018-02-19 20:54:37 +01:00
parent 1f1bbb3518
commit baafb6325b
706 changed files with 49633 additions and 5044 deletions

View file

@ -189,6 +189,48 @@ static inline void circlebuf_push_front(struct circlebuf *cb, const void *data,
}
}
static inline void circlebuf_push_back_zero(struct circlebuf *cb, size_t size)
{
size_t new_end_pos = cb->end_pos + size;
cb->size += size;
circlebuf_ensure_capacity(cb);
if (new_end_pos > cb->capacity) {
size_t back_size = cb->capacity - cb->end_pos;
size_t loop_size = size - back_size;
if (back_size)
memset((uint8_t*)cb->data + cb->end_pos, 0, back_size);
memset(cb->data, 0, loop_size);
new_end_pos -= cb->capacity;
} else {
memset((uint8_t*)cb->data + cb->end_pos, 0, size);
}
cb->end_pos = new_end_pos;
}
static inline void circlebuf_push_front_zero(struct circlebuf *cb, size_t size)
{
cb->size += size;
circlebuf_ensure_capacity(cb);
if (cb->start_pos < size) {
size_t back_size = size - cb->start_pos;
if (cb->start_pos)
memset(cb->data, 0, cb->start_pos);
cb->start_pos = cb->capacity - back_size;
memset((uint8_t*)cb->data + cb->start_pos, 0, back_size);
} else {
cb->start_pos -= size;
memset((uint8_t*)cb->data + cb->start_pos, 0, size);
}
}
static inline void circlebuf_peek_front(struct circlebuf *cb, void *data,
size_t size)
{
@ -237,6 +279,11 @@ static inline void circlebuf_pop_front(struct circlebuf *cb, void *data,
circlebuf_peek_front(cb, data, size);
cb->size -= size;
if (!cb->size) {
cb->start_pos = cb->end_pos = 0;
return;
}
cb->start_pos += size;
if (cb->start_pos >= cb->capacity)
cb->start_pos -= cb->capacity;
@ -248,6 +295,11 @@ static inline void circlebuf_pop_back(struct circlebuf *cb, void *data,
circlebuf_peek_front(cb, data, size);
cb->size -= size;
if (!cb->size) {
cb->start_pos = cb->end_pos = 0;
return;
}
if (cb->end_pos <= size)
cb->end_pos = cb->capacity - (size - cb->end_pos);
else