summaryrefslogtreecommitdiff
path: root/cpp/msgpack
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/msgpack')
-rw-r--r--cpp/msgpack/sbuffer.h4
-rw-r--r--cpp/msgpack/sbuffer.hpp5
-rw-r--r--cpp/msgpack/vrefbuffer.h3
-rw-r--r--cpp/msgpack/vrefbuffer.hpp5
4 files changed, 17 insertions, 0 deletions
diff --git a/cpp/msgpack/sbuffer.h b/cpp/msgpack/sbuffer.h
index bc0a8fd..57f424a 100644
--- a/cpp/msgpack/sbuffer.h
+++ b/cpp/msgpack/sbuffer.h
@@ -77,6 +77,10 @@ static inline char* msgpack_sbuffer_release(msgpack_sbuffer* sbuf)
return tmp;
}
+static inline void msgpack_sbuffer_clear(msgpack_sbuffer* sbuf)
+{
+ sbuf->size = 0;
+}
#ifdef __cplusplus
}
diff --git a/cpp/msgpack/sbuffer.hpp b/cpp/msgpack/sbuffer.hpp
index ca06884e..e4a3f96 100644
--- a/cpp/msgpack/sbuffer.hpp
+++ b/cpp/msgpack/sbuffer.hpp
@@ -72,6 +72,11 @@ public:
return msgpack_sbuffer_release(this);
}
+ void clear()
+ {
+ msgpack_sbuffer_clear(this);
+ }
+
private:
void expand_buffer(size_t len)
{
diff --git a/cpp/msgpack/vrefbuffer.h b/cpp/msgpack/vrefbuffer.h
index 38ead67..a08e0d0 100644
--- a/cpp/msgpack/vrefbuffer.h
+++ b/cpp/msgpack/vrefbuffer.h
@@ -80,6 +80,9 @@ int msgpack_vrefbuffer_append_ref(msgpack_vrefbuffer* vbuf,
int msgpack_vrefbuffer_migrate(msgpack_vrefbuffer* vbuf, msgpack_vrefbuffer* to);
+void msgpack_vrefbuffer_clear(msgpack_vrefbuffer* vref);
+
+
int msgpack_vrefbuffer_write(void* data, const char* buf, unsigned int len)
{
msgpack_vrefbuffer* vbuf = (msgpack_vrefbuffer*)data;
diff --git a/cpp/msgpack/vrefbuffer.hpp b/cpp/msgpack/vrefbuffer.hpp
index c8eca7b..7e0ffb2 100644
--- a/cpp/msgpack/vrefbuffer.hpp
+++ b/cpp/msgpack/vrefbuffer.hpp
@@ -78,6 +78,11 @@ public:
}
}
+ void clear()
+ {
+ msgpack_vrefbuffer_clear(this);
+ }
+
private:
typedef msgpack_vrefbuffer base;