mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-10-15 07:14:48 +02:00
cpp: adds msgpack_sbuffer_new and msgpack_sbuffer_free
This commit is contained in:
@@ -46,6 +46,18 @@ static inline void msgpack_sbuffer_destroy(msgpack_sbuffer* sbuf)
|
|||||||
free(sbuf->data);
|
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)
|
static inline int msgpack_sbuffer_write(void* data, const char* buf, unsigned int len)
|
||||||
{
|
{
|
||||||
msgpack_sbuffer* sbuf = (msgpack_sbuffer*)data;
|
msgpack_sbuffer* sbuf = (msgpack_sbuffer*)data;
|
||||||
|
Reference in New Issue
Block a user