diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-02-18 17:37:57 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-02-18 17:37:57 -0200 |
commit | d08d237a49ff3cb961012b1de374914af6da3000 (patch) | |
tree | 493a40f66f867ac3c8e882ebbe335c8d584fcd93 | |
parent | 64a7ec987cae3c59353600bf76bf635d0906b0cf (diff) | |
download | lua-d08d237a49ff3cb961012b1de374914af6da3000.tar.gz lua-d08d237a49ff3cb961012b1de374914af6da3000.tar.bz2 lua-d08d237a49ff3cb961012b1de374914af6da3000.zip |
detail: in loadfile read function, no need to return NULL on EOF;
size ==0 is enough to signal EOF.
-rw-r--r-- | lauxlib.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.c,v 1.199 2010/02/18 19:18:41 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.200 2010/02/18 19:32:41 roberto Exp roberto $ |
3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -516,7 +516,7 @@ static const char *getF (lua_State *L, void *ud, size_t *size) { | |||
516 | if (feof(lf->f)) return NULL; | 516 | if (feof(lf->f)) return NULL; |
517 | *size = fread(lf->buff, 1, sizeof(lf->buff), lf->f); | 517 | *size = fread(lf->buff, 1, sizeof(lf->buff), lf->f); |
518 | } | 518 | } |
519 | return (*size > 0) ? lf->buff : NULL; | 519 | return lf->buff; |
520 | } | 520 | } |
521 | 521 | ||
522 | 522 | ||