MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / mp_buf_new

Function mp_buf_new

deps/lua/src/lua_cmsgpack.c:107–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105}
106
107mp_buf *mp_buf_new(lua_State *L) {
108 mp_buf *buf = NULL;
109
110 /* Old size = 0; new size = sizeof(*buf) */
111 buf = (mp_buf*)mp_realloc(L, NULL, 0, sizeof(*buf));
112
113 buf->b = NULL;
114 buf->len = buf->free = 0;
115 return buf;
116}
117
118void mp_buf_append(lua_State *L, mp_buf *buf, const unsigned char *s, size_t len) {
119 if (buf->free < len) {

Callers 1

mp_packFunction · 0.85

Calls 1

mp_reallocFunction · 0.85

Tested by

no test coverage detected