1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

allow cbuf as chain

This commit is contained in:
Markus Sattler 2016-01-26 17:40:01 +01:00
parent 46c096ba23
commit fa38ce4079
2 changed files with 4 additions and 1 deletions

View File

@ -22,7 +22,7 @@
#include "c_types.h"
cbuf::cbuf(size_t size) :
_size(size), _buf(new char[size]), _bufend(_buf + size), _begin(_buf), _end(_begin) {
next(NULL), _size(size), _buf(new char[size]), _bufend(_buf + size), _begin(_buf), _end(_begin) {
}
cbuf::~cbuf() {

View File

@ -56,6 +56,8 @@ class cbuf {
void flush();
size_t remove(size_t size);
cbuf *next;
private:
inline char* wrap_if_bufend(char* ptr) const {
return (ptr == _bufend) ? _buf : ptr;
@ -66,6 +68,7 @@ class cbuf {
const char* _bufend;
char* _begin;
char* _end;
};
#endif//__cbuf_h