[hackers] [scc] [cc1] use for instead of while in main() || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Thu, 19 Jan 2017 10:00:32 +0100 (CET)

commit 6aec731e498f8c7994c24f88b036fa942f05d796
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Wed Jan 18 12:24:10 2017 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Wed Jan 18 13:15:32 2017 +0100

    [cc1] use for instead of while in main()

diff --git a/cc1/lex.c b/cc1/lex.c
index 4c0fd35..83c0be3 100644
--- a/cc1/lex.c
+++ b/cc1/lex.c
_AT_@ -72,7 +72,7 @@ int
 addinput(char *fname, Symbol *hide, char *buffer)
 {
         FILE *fp;
- unsigned type, nline = 0;
+ unsigned flags, nline = 0;
         Input *ip;
 
         if (hide) {
_AT_@ -83,17 +83,17 @@ addinput(char *fname, Symbol *hide, char *buffer)
                 if (hide->hide == UCHAR_MAX)
                         die("Too many macro expansions");
                 ++hide->hide;
- type = IMACRO;
+ flags = IMACRO|IEOF;
         } else if (fname) {
                 /* a new file */
                 if ((fp = fopen(fname, "r")) == NULL)
                         return 0;
- type = IFILE;
+ flags = IFILE;
         } else {
                 /* reading from stdin */
                 fp = stdin;
                 fname = "<stdin>";
- type = ISTDIN;
+ flags = ISTDIN;
         }
 
         ip = xmalloc(sizeof(*ip));
_AT_@ -109,7 +109,7 @@ addinput(char *fname, Symbol *hide, char *buffer)
         ip->fp = fp;
         ip->hide = hide;
         ip->nline = nline;
- ip->flags = type;
+ ip->flags = flags;
         input = ip;
 
         return 1;
diff --git a/cc1/main.c b/cc1/main.c
index 5531c19..baadd53 100644
--- a/cc1/main.c
+++ b/cc1/main.c
_AT_@ -109,10 +109,8 @@ main(int argc, char *argv[])
         if (onlycpp) {
                 outcpp();
         } else {
- next();
-
- while (yytoken != EOFTOK)
- decl();
+ for (next(); yytoken != EOFTOK; decl())
+ /* nothing */;
         }
 
         return failure;
Received on Thu Jan 19 2017 - 10:00:32 CET

This archive was generated by hypermail 2.3.0 : Thu Jan 19 2017 - 10:12:23 CET