MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / f_setvbuf

Function f_setvbuf

lib/lua/src/liolib.c:723–733  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

721
722
723static int f_setvbuf (lua_State *L) {
724 static const int mode[] = {_IONBF, _IOFBF, _IOLBF};
725 static const char *const modenames[] = {"no", "full", "line", NULL};
726 FILE *f = tofile(L);
727 int op = luaL_checkoption(L, 2, NULL, modenames);
728 lua_Integer sz = luaL_optinteger(L, 3, LUAL_BUFFERSIZE);
729 int res;
730 errno = 0;
731 res = setvbuf(f, NULL, mode[op], (size_t)sz);
732 return luaL_fileresult(L, res == 0, NULL);
733}
734
735
736

Callers

nothing calls this directly

Calls 4

tofileFunction · 0.85
luaL_checkoptionFunction · 0.85
luaL_optintegerFunction · 0.85
luaL_fileresultFunction · 0.85

Tested by

no test coverage detected