| 524 | |
| 525 | |
| 526 | static void read_all (lua_State *L, FILE *f) { |
| 527 | size_t nr; |
| 528 | luaL_Buffer b; |
| 529 | luaL_buffinit(L, &b); |
| 530 | do { /* read file in chunks of LUAL_BUFFERSIZE bytes */ |
| 531 | char *p = luaL_prepbuffer(&b); |
| 532 | nr = fread(p, sizeof(char), LUAL_BUFFERSIZE, f); |
| 533 | luaL_addsize(&b, nr); |
| 534 | } while (nr == LUAL_BUFFERSIZE); |
| 535 | luaL_pushresult(&b); /* close buffer */ |
| 536 | } |
| 537 | |
| 538 | |
| 539 | static int read_chars (lua_State *L, FILE *f, size_t n) { |
no test coverage detected