MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / addstr2buff

Function addstr2buff

extlibs/lua/src/lobject.c:433–443  ·  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

431** push the string directly to the stack.
432*/
433static void addstr2buff (BuffFS *buff, const char *str, size_t slen) {
434 if (slen <= BUFVFS) { /* does string fit into buffer? */
435 char *bf = getbuff(buff, cast_int(slen));
436 memcpy(bf, str, slen); /* add string to buffer */
437 addsize(buff, cast_int(slen));
438 }
439 else { /* string larger than buffer */
440 clearbuff(buff); /* string comes after buffer's content */
441 pushstr(buff, str, slen); /* push string */
442 }
443}
444
445
446/*

Callers 1

luaO_pushvfstringFunction · 0.85

Calls 3

getbuffFunction · 0.85
clearbuffFunction · 0.85
pushstrFunction · 0.85

Tested by

no test coverage detected