diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2012-03-19 19:57:14 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2012-03-19 19:57:14 -0300 |
| commit | 3e66d3b4bebe58a7acaa232b8f3e89f9d3131a96 (patch) | |
| tree | a0a2294b920cbc1f60d36e6c0f6fc4ba21b1aab7 | |
| parent | 29a28693e5018ad715723ea4ef38433559313b10 (diff) | |
| download | lua-3e66d3b4bebe58a7acaa232b8f3e89f9d3131a96.tar.gz lua-3e66d3b4bebe58a7acaa232b8f3e89f9d3131a96.tar.bz2 lua-3e66d3b4bebe58a7acaa232b8f3e89f9d3131a96.zip | |
cleaner code (avoids loop with empty body)
| -rw-r--r-- | lauxlib.c | 8 |
1 files changed, 5 insertions, 3 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lauxlib.c,v 1.240 2011/12/06 16:33:55 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.241 2012/03/18 16:52:49 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 | */ |
| @@ -616,8 +616,10 @@ static int skipBOM (LoadF *lf) { | |||
| 616 | static int skipcomment (LoadF *lf, int *cp) { | 616 | static int skipcomment (LoadF *lf, int *cp) { |
| 617 | int c = *cp = skipBOM(lf); | 617 | int c = *cp = skipBOM(lf); |
| 618 | if (c == '#') { /* first line is a comment (Unix exec. file)? */ | 618 | if (c == '#') { /* first line is a comment (Unix exec. file)? */ |
| 619 | while ((c = getc(lf->f)) != EOF && c != '\n') ; /* skip first line */ | 619 | do { /* skip first line */ |
| 620 | *cp = getc(lf->f); /* skip end-of-line */ | 620 | c = getc(lf->f); |
| 621 | } while (c != EOF && c != '\n') ; | ||
| 622 | *cp = getc(lf->f); /* skip end-of-line, if present */ | ||
| 621 | return 1; /* there was a comment */ | 623 | return 1; /* there was a comment */ |
| 622 | } | 624 | } |
| 623 | else return 0; /* no comment */ | 625 | else return 0; /* no comment */ |
