| 503 | |
| 504 | |
| 505 | static 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 | |
| 518 | static int read_chars (lua_State *L, FILE *f, size_t n) { |
no test coverage detected