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

Function adjuststack

deps/lua/src/lauxlib.c:410–426  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

408
409
410static void adjuststack (luaL_Buffer *B) {
411 if (B->lvl > 1) {
412 lua_State *L = B->L;
413 int toget = 1; /* number of levels to concat */
414 size_t toplen = lua_strlen(L, -1);
415 do {
416 size_t l = lua_strlen(L, -(toget+1));
417 if (B->lvl - toget + 1 >= LIMIT || toplen > l) {
418 toplen += l;
419 toget++;
420 }
421 else break;
422 } while (toget < B->lvl);
423 lua_concat(L, toget);
424 B->lvl = B->lvl - toget + 1;
425 }
426}
427
428
429LUALIB_API char *luaL_prepbuffer (luaL_Buffer *B) {

Callers 2

luaL_prepbufferFunction · 0.85
luaL_addvalueFunction · 0.85

Calls 1

lua_concatFunction · 0.85

Tested by

no test coverage detected