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

Function addstr2buff

third-party/lua-5.4.6/src/lobject.c:453–463  ·  view source on GitHub ↗

** Add 'str' to the buffer. If string is larger than the buffer space, ** push the string directly to the stack. */

Source from the content-addressed store, hash-verified

451** push the string directly to the stack.
452*/
453static void addstr2buff (BuffFS *buff, const char *str, size_t slen) {
454 if (slen <= BUFVFS) { /* does string fit into buffer? */
455 char *bf = getbuff(buff, cast_int(slen));
456 memcpy(bf, str, slen); /* add string to buffer */
457 addsize(buff, cast_int(slen));
458 }
459 else { /* string larger than buffer */
460 clearbuff(buff); /* string comes after buffer's content */
461 pushstr(buff, str, slen); /* push string */
462 }
463}
464
465
466/*

Callers 1

luaO_pushvfstringFunction · 0.70

Calls 3

getbuffFunction · 0.85
clearbuffFunction · 0.70
pushstrFunction · 0.70

Tested by

no test coverage detected