| 408 | |
| 409 | |
| 410 | static 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 | |
| 429 | LUALIB_API char *luaL_prepbuffer (luaL_Buffer *B) { |
no test coverage detected