| 456 | |
| 457 | |
| 458 | static 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 | |
| 477 | LUALIB_API char *luaL_prepbuffer (luaL_Buffer *B) { |
no test coverage detected