MCPcopy Create free account
hub / github.com/DFHack/dfhack / read_all

Function read_all

depends/lua/src/liolib.c:505–515  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

503
504
505static void read_all (lua_State *L, FILE *f) {
506 size_t nr;
507 luaL_Buffer b;
508 luaL_buffinit(L, &b);
509 do { /* read file in chunks of LUAL_BUFFERSIZE bytes */
510 char *p = luaL_prepbuffer(&b);
511 nr = fread(p, sizeof(char), LUAL_BUFFERSIZE, f);
512 luaL_addsize(&b, nr);
513 } while (nr == LUAL_BUFFERSIZE);
514 luaL_pushresult(&b); /* close buffer */
515}
516
517
518static 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