MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / read_all

Function read_all

3rd/lua-5.4.3/src/liolib.c:540–550  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

538
539
540static void read_all (lua_State *L, FILE *f) {
541 size_t nr;
542 luaL_Buffer b;
543 luaL_buffinit(L, &b);
544 do { /* read file in chunks of LUAL_BUFFERSIZE bytes */
545 char *p = luaL_prepbuffer(&b);
546 nr = fread(p, sizeof(char), LUAL_BUFFERSIZE, f);
547 luaL_addsize(&b, nr);
548 } while (nr == LUAL_BUFFERSIZE);
549 luaL_pushresult(&b); /* close buffer */
550}
551
552
553static 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