MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / read_chars

Function read_chars

extlibs/lua/src/liolib.c:539–549  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

537
538
539static int read_chars (lua_State *L, FILE *f, size_t n) {
540 size_t nr; /* number of chars actually read */
541 char *p;
542 luaL_Buffer b;
543 luaL_buffinit(L, &b);
544 p = luaL_prepbuffsize(&b, n); /* prepare buffer to read whole block */
545 nr = fread(p, sizeof(char), n, f); /* try to read 'n' chars */
546 luaL_addsize(&b, nr);
547 luaL_pushresult(&b); /* close buffer */
548 return (nr > 0); /* true iff read something */
549}
550
551
552static int g_read (lua_State *L, FILE *f, int first) {

Callers 1

g_readFunction · 0.85

Calls 3

luaL_buffinitFunction · 0.70
luaL_prepbuffsizeFunction · 0.70
luaL_pushresultFunction · 0.70

Tested by

no test coverage detected