Skip to content

Commit 4ecfb87

Browse files
committed
Revert "Fixing bugs when attempting to read from ringbuffer"
This reverts commit 9a14dd6.
1 parent 235fd2a commit 4ecfb87

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

api/RingBuffer.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ class RingBufferN
5252

5353
private:
5454
int nextIndex(int index);
55-
inline bool isEmpty() const { return (_numElems == 0); }
5655
};
5756

5857
typedef RingBufferN<SERIAL_BUFFER_SIZE> RingBuffer;
@@ -91,7 +90,7 @@ void RingBufferN<N>::clear()
9190
template <int N>
9291
int RingBufferN<N>::read_char()
9392
{
94-
if (isEmpty())
93+
if(_iTail == _iHead)
9594
return -1;
9695

9796
uint8_t value = _aucBuffer[_iTail];
@@ -123,7 +122,7 @@ int RingBufferN<N>::availableForStore()
123122
template <int N>
124123
int RingBufferN<N>::peek()
125124
{
126-
if (isEmpty())
125+
if(_iTail == _iHead)
127126
return -1;
128127

129128
return _aucBuffer[_iTail];

0 commit comments

Comments
 (0)