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

Function luaL_addvalue

deps/lua/src/lauxlib.c:454–469  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

452
453
454LUALIB_API void luaL_addvalue (luaL_Buffer *B) {
455 lua_State *L = B->L;
456 size_t vl;
457 const char *s = lua_tolstring(L, -1, &vl);
458 if (vl <= bufffree(B)) { /* fit into buffer? */
459 memcpy(B->p, s, vl); /* put it there */
460 B->p += vl;
461 lua_pop(L, 1); /* remove from stack */
462 }
463 else {
464 if (emptybuffer(B))
465 lua_insert(L, -2); /* put buffer before new value */
466 B->lvl++; /* add new value into B stack */
467 adjuststack(B);
468 }
469}
470
471
472LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) {

Callers 4

add_sFunction · 0.85
add_valueFunction · 0.85
str_formatFunction · 0.85
addfieldFunction · 0.85

Calls 4

lua_tolstringFunction · 0.85
emptybufferFunction · 0.85
lua_insertFunction · 0.85
adjuststackFunction · 0.85

Tested by

no test coverage detected