MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / adjuststack

Function adjuststack

lua/lauxlib.c:458–474  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

456
457
458static void adjuststack (luaL_Buffer *B) {
459 if (B->lvl > 1) {
460 lua_State *L = B->L;
461 int toget = 1; /* number of levels to concat */
462 size_t toplen = lua_strlen(L, -1);
463 do {
464 size_t l = lua_strlen(L, -(toget+1));
465 if (B->lvl - toget + 1 >= LIMIT || toplen > l) {
466 toplen += l;
467 toget++;
468 }
469 else break;
470 } while (toget < B->lvl);
471 lua_concat(L, toget);
472 B->lvl = B->lvl - toget + 1;
473 }
474}
475
476
477LUALIB_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