MCPcopy Create free account
hub / github.com/Cubitect/cubiomes-viewer / newbuffsize

Function newbuffsize

lua/src/lauxlib.c:531–538  ·  view source on GitHub ↗

** Compute new size for buffer 'B', enough to accommodate extra 'sz' ** bytes. */

Source from the content-addressed store, hash-verified

529** bytes.
530*/
531static size_t newbuffsize (luaL_Buffer *B, size_t sz) {
532 size_t newsize = B->size * 2; /* double buffer size */
533 if (l_unlikely(MAX_SIZET - sz < B->n)) /* overflow in (B->n + sz)? */
534 return luaL_error(B->L, "buffer too large");
535 if (newsize < B->n + sz) /* double is not big enough? */
536 newsize = B->n + sz;
537 return newsize;
538}
539
540
541/*

Callers 1

prepbuffsizeFunction · 0.85

Calls 1

luaL_errorFunction · 0.85

Tested by

no test coverage detected