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

Function read_chars

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

Source from the content-addressed store, hash-verified

551
552
553static int read_chars (lua_State *L, FILE *f, size_t n) {
554 size_t nr; /* number of chars actually read */
555 char *p;
556 luaL_Buffer b;
557 luaL_buffinit(L, &b);
558 p = luaL_prepbuffsize(&b, n); /* prepare buffer to read whole block */
559 nr = fread(p, sizeof(char), n, f); /* try to read 'n' chars */
560 luaL_addsize(&b, nr);
561 luaL_pushresult(&b); /* close buffer */
562 return (nr > 0); /* true iff read something */
563}
564
565
566static int g_read (lua_State *L, FILE *f, int first) {

Callers 1

g_readFunction · 0.85

Calls 3

luaL_buffinitFunction · 0.85
luaL_prepbuffsizeFunction · 0.85
luaL_pushresultFunction · 0.85

Tested by

no test coverage detected