From b9ce447cc9f9918dbd535e76dbb04d030e5e4e91 Mon Sep 17 00:00:00 2001 From: Ban Siesta Date: Sun, 24 May 2015 10:01:28 +0100 Subject: [PATCH] ringbuffer: whitespace --- src/drivers/device/ringbuffer.cpp | 30 +++++++++++++++--------------- src/drivers/device/ringbuffer.h | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/drivers/device/ringbuffer.cpp b/src/drivers/device/ringbuffer.cpp index 1790289338..239b263ec2 100644 --- a/src/drivers/device/ringbuffer.cpp +++ b/src/drivers/device/ringbuffer.cpp @@ -57,25 +57,25 @@ RingBuffer::~RingBuffer() unsigned RingBuffer::_next(unsigned index) { - return (0 == index) ? _num_items : (index - 1); + return (0 == index) ? _num_items : (index - 1); } bool RingBuffer::empty() { - return _tail == _head; + return _tail == _head; } bool RingBuffer::full() { - return _next(_head) == _tail; + return _next(_head) == _tail; } unsigned RingBuffer::size() { - return (_buf != nullptr) ? _num_items : 0; + return (_buf != nullptr) ? _num_items : 0; } void @@ -86,7 +86,7 @@ RingBuffer::flush() } bool -RingBuffer::put(const void *val, size_t val_size) +RingBuffer::put(const void *val, size_t val_size) { unsigned next = _next(_head); if (next != _tail) { @@ -250,7 +250,7 @@ static inline bool my_sync_bool_compare_and_swap(volatile unsigned *a, unsigned #define __PX4_SBCAP __sync_bool_compare_and_swap #endif bool -RingBuffer::get(void *val, size_t val_size) +RingBuffer::get(void *val, size_t val_size) { if (_tail != _head) { unsigned candidate; @@ -340,7 +340,7 @@ RingBuffer::get(double &val) } unsigned -RingBuffer::space(void) +RingBuffer::space(void) { unsigned tail, head; @@ -361,7 +361,7 @@ RingBuffer::space(void) } unsigned -RingBuffer::count(void) +RingBuffer::count(void) { /* * Note that due to the conservative nature of space(), this may @@ -371,7 +371,7 @@ RingBuffer::count(void) } bool -RingBuffer::resize(unsigned new_size) +RingBuffer::resize(unsigned new_size) { char *old_buffer; char *new_buffer = new char [(new_size+1) * _item_size]; @@ -388,13 +388,13 @@ RingBuffer::resize(unsigned new_size) } void -RingBuffer::print_info(const char *name) +RingBuffer::print_info(const char *name) { printf("%s %u/%lu (%u/%u @ %p)\n", - name, - _num_items, - (unsigned long)_num_items * _item_size, - _head, - _tail, + name, + _num_items, + (unsigned long)_num_items * _item_size, + _head, + _tail, _buf); } diff --git a/src/drivers/device/ringbuffer.h b/src/drivers/device/ringbuffer.h index 1c65c02135..26d0df0272 100644 --- a/src/drivers/device/ringbuffer.h +++ b/src/drivers/device/ringbuffer.h @@ -161,7 +161,7 @@ public: private: unsigned _num_items; const size_t _item_size; - char *_buf; + char *_buf; volatile unsigned _head; /**< insertion point in _item_size units */ volatile unsigned _tail; /**< removal point in _item_size units */