** Push final result from 'luaO_pushvfstring'. This function may raise ** errors explicitly or through memory errors, so it must run protected. */
| 511 | ** errors explicitly or through memory errors, so it must run protected. |
| 512 | */ |
| 513 | static void pushbuff (lua_State *L, void *ud) { |
| 514 | BuffFS *buff = cast(BuffFS*, ud); |
| 515 | switch (buff->err) { |
| 516 | case 1: /* memory error */ |
| 517 | luaD_throw(L, LUA_ERRMEM); |
| 518 | break; |
| 519 | case 2: /* length overflow: Add "..." at the end of result */ |
| 520 | if (buff->buffsize - buff->blen < 3) |
| 521 | strcpy(buff->b + buff->blen - 3, "..."); /* 'blen' must be > 3 */ |
| 522 | else { /* there is enough space left for the "..." */ |
| 523 | strcpy(buff->b + buff->blen, "..."); |
| 524 | buff->blen += 3; |
| 525 | } |
| 526 | /* FALLTHROUGH */ |
| 527 | default: { /* no errors, but it can raise one creating the new string */ |
| 528 | TString *ts = luaS_newlstr(L, buff->b, buff->blen); |
| 529 | setsvalue2s(L, L->top.p, ts); |
| 530 | L->top.p++; |
| 531 | } |
| 532 | } |
| 533 | } |
| 534 | |
| 535 | |
| 536 | static const char *clearbuff (BuffFS *buff) { |
nothing calls this directly
no test coverage detected