| 538 | |
| 539 | |
| 540 | static 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 | |
| 553 | static int read_chars (lua_State *L, FILE *f, size_t n) { |
no test coverage detected