summaryrefslogtreecommitdiffstats
path: root/document
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@oath.com>2018-06-11 23:41:52 +0200
committerHenning Baldersheim <balder@oath.com>2018-06-12 08:43:52 +0200
commit9f96f83dc5e733f8d34879e1aa908852429bbcf0 (patch)
tree6fff4044d2ac966ea6419f88d0c4d6cb8dc242f9 /document
parentc3cbe79487a64df1432b16507b7a7760b576a5f1 (diff)
Inline flip/clear
Diffstat (limited to 'document')
-rw-r--r--document/src/vespa/document/util/bytebuffer.cpp19
-rw-r--r--document/src/vespa/document/util/bytebuffer.h10
2 files changed, 9 insertions, 20 deletions
diff --git a/document/src/vespa/document/util/bytebuffer.cpp b/document/src/vespa/document/util/bytebuffer.cpp
index 6d3fbec6b16..71f9050924e 100644
--- a/document/src/vespa/document/util/bytebuffer.cpp
+++ b/document/src/vespa/document/util/bytebuffer.cpp
@@ -249,30 +249,13 @@ ByteBuffer::setLimit(size_t limit) // throw (BufferOutOfBoundsException)
}
}
-void ByteBuffer::clear()
-{
- LOG_DEBUG1("Clearing content. Setting pos to 0");
- _pos=0;
- _limit=_len;
-}
-
-void ByteBuffer::flip()
-{
- LOG_DEBUG2("Flipping buffer. Setting limit to %" PRIu64 ".", _pos);
- _limit = _pos;
- _pos = 0;
-}
-
ByteBuffer::BufferHolder::BufferHolder(Alloc buffer)
: _buffer(std::move(buffer))
{
}
-ByteBuffer::BufferHolder::~BufferHolder()
-{
-}
-
+ByteBuffer::BufferHolder::~BufferHolder() = default;
void ByteBuffer::dump() const
{
fprintf(stderr, "ByteBuffer: Length %lu, Pos %lu, Limit %lu\n",
diff --git a/document/src/vespa/document/util/bytebuffer.h b/document/src/vespa/document/util/bytebuffer.h
index bdf927f209d..6467e6d8bf0 100644
--- a/document/src/vespa/document/util/bytebuffer.h
+++ b/document/src/vespa/document/util/bytebuffer.h
@@ -155,13 +155,19 @@ public:
* Resets pos to 0, and sets limit to old pos. Use this before reading
* from a buffer you have written to
*/
- void flip();
+ void flip() {
+ _limit = _pos;
+ _pos = 0;
+ }
/**
* Sets pos to 0 and limit to length. Use this to start writing from the
* start of the buffer.
*/
- void clear();
+ void clear() {
+ _pos=0;
+ _limit=_len;
+ }
void getNumericNetwork(uint8_t & v) { getNumeric(v); }
void getNumeric(uint8_t & v);