commit 3e66d3b4bebe58a7acaa232b8f3e89f9d3131a96
parent 29a28693e5018ad715723ea4ef38433559313b10
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Mon, 19 Mar 2012 19:56:50 -0300
cleaner code (avoids loop with empty body)
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/lauxlib.c b/lauxlib.c
@@ -1,5 +1,5 @@
/*
-** $Id: lauxlib.c,v 1.240 2011/12/06 16:33:55 roberto Exp roberto $
+** $Id: lauxlib.c,v 1.241 2012/03/18 16:52:49 roberto Exp roberto $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/
@@ -616,8 +616,10 @@ static int skipBOM (LoadF *lf) {
static int skipcomment (LoadF *lf, int *cp) {
int c = *cp = skipBOM(lf);
if (c == '#') { /* first line is a comment (Unix exec. file)? */
- while ((c = getc(lf->f)) != EOF && c != '\n') ; /* skip first line */
- *cp = getc(lf->f); /* skip end-of-line */
+ do { /* skip first line */
+ c = getc(lf->f);
+ } while (c != EOF && c != '\n') ;
+ *cp = getc(lf->f); /* skip end-of-line, if present */
return 1; /* there was a comment */
}
else return 0; /* no comment */