summaryrefslogtreecommitdiff
path: root/cpp/src/msgpack/sbuffer.h
diff options
context:
space:
mode:
authorfrsyuki <frsyuki@users.sourceforge.jp>2010-06-01 07:10:17 +0900
committerfrsyuki <frsyuki@users.sourceforge.jp>2010-06-01 07:10:17 +0900
commite49f091b4ebc7abbad92848502a6e06d4e9d6cfa (patch)
tree719d020c30af6d3c63c0d440fd03139675997d0d /cpp/src/msgpack/sbuffer.h
parent6056f939103624d21092a5e4a4d8ffaf9204c191 (diff)
downloadmsgpack-python-e49f091b4ebc7abbad92848502a6e06d4e9d6cfa.tar.gz
cpp: adds msgpack_sbuffer_new and msgpack_sbuffer_free
Diffstat (limited to 'cpp/src/msgpack/sbuffer.h')
-rw-r--r--cpp/src/msgpack/sbuffer.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/cpp/src/msgpack/sbuffer.h b/cpp/src/msgpack/sbuffer.h
index 57f424a..caff2e8 100644
--- a/cpp/src/msgpack/sbuffer.h
+++ b/cpp/src/msgpack/sbuffer.h
@@ -46,6 +46,18 @@ static inline void msgpack_sbuffer_destroy(msgpack_sbuffer* sbuf)
free(sbuf->data);
}
+static inline msgpack_sbuffer* msgpack_sbuffer_new(void)
+{
+ return (msgpack_sbuffer*)calloc(1, sizeof(msgpack_sbuffer));
+}
+
+static inline void msgpack_sbuffer_free(msgpack_sbuffer* sbuf)
+{
+ if(sbuf == NULL) { return; }
+ msgpack_sbuffer_destroy(sbuf);
+ free(sbuf);
+}
+
static inline int msgpack_sbuffer_write(void* data, const char* buf, unsigned int len)
{
msgpack_sbuffer* sbuf = (msgpack_sbuffer*)data;