MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / pushbuff

Function pushbuff

third-party/lua-5.5.0/src/lobject.c:513–533  ·  view source on GitHub ↗

** Push final result from 'luaO_pushvfstring'. This function may raise ** errors explicitly or through memory errors, so it must run protected. */

Source from the content-addressed store, hash-verified

511** errors explicitly or through memory errors, so it must run protected.
512*/
513static 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
536static const char *clearbuff (BuffFS *buff) {

Callers

nothing calls this directly

Calls 2

luaD_throwFunction · 0.70
luaS_newlstrFunction · 0.70

Tested by

no test coverage detected