fifo_buffer.c - nits

This commit is contained in:
twinaphex 2015-01-05 15:44:20 +01:00
parent c518d35f18
commit 41acfb52d4

View File

@ -48,7 +48,7 @@ void fifo_free(fifo_buffer_t *buffer)
size_t fifo_read_avail(fifo_buffer_t *buffer)
{
size_t first = buffer->first;
size_t end = buffer->end;
size_t end = buffer->end;
if (end < first)
end += buffer->bufsize;
return end - first;
@ -57,7 +57,7 @@ size_t fifo_read_avail(fifo_buffer_t *buffer)
size_t fifo_write_avail(fifo_buffer_t *buffer)
{
size_t first = buffer->first;
size_t end = buffer->end;
size_t end = buffer->end;
if (end < first)
end += buffer->bufsize;
@ -67,7 +67,8 @@ size_t fifo_write_avail(fifo_buffer_t *buffer)
void fifo_write(fifo_buffer_t *buffer, const void *in_buf, size_t size)
{
size_t first_write = size;
size_t rest_write = 0;
size_t rest_write = 0;
if (buffer->end + size > buffer->bufsize)
{
first_write = buffer->bufsize - buffer->end;
@ -84,7 +85,7 @@ void fifo_write(fifo_buffer_t *buffer, const void *in_buf, size_t size)
void fifo_read(fifo_buffer_t *buffer, void *in_buf, size_t size)
{
size_t first_read = size;
size_t rest_read = 0;
size_t rest_read = 0;
if (buffer->first + size > buffer->bufsize)
{
first_read = buffer->bufsize - buffer->first;