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

Function read_all

lib/lua/src/liolib.c:543–553  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

541
542
543static void read_all (lua_State *L, FILE *f) {
544 size_t nr;
545 luaL_Buffer b;
546 luaL_buffinit(L, &b);
547 do { /* read file in chunks of LUAL_BUFFERSIZE bytes */
548 char *p = luaL_prepbuffer(&b);
549 nr = fread(p, sizeof(char), LUAL_BUFFERSIZE, f);
550 luaL_addsize(&b, nr);
551 } while (nr == LUAL_BUFFERSIZE);
552 luaL_pushresult(&b); /* close buffer */
553}
554
555
556static int read_chars (lua_State *L, FILE *f, size_t n) {

Callers 1

g_readFunction · 0.85

Calls 2

luaL_buffinitFunction · 0.85
luaL_pushresultFunction · 0.85

Tested by

no test coverage detected