From a3e53d37aa44b2a8a73674b0c35f2e2fc87a44ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jurko=20Gospodneti=C4=87?= Date: Tue, 2 Sep 2008 10:58:03 +0000 Subject: [PATCH] Refactored Boost Jam's internal yyline() Jamfile parsing function a bit so it no longer uses one unneeded goto that was making the code much harder to read. [SVN r48533] --- src/engine/scan.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/engine/scan.c b/src/engine/scan.c index 9b1d46ad8..692799ac0 100644 --- a/src/engine/scan.c +++ b/src/engine/scan.c @@ -129,33 +129,33 @@ int yyline() /* If we are reading from an internal string list, go to the next string. */ if ( i->strings ) { - if ( !*i->strings ) - goto next; - - ++i->line; - i->string = *(i->strings++); - return *i->string++; + if ( *i->strings ) + { + ++i->line; + i->string = *(i->strings++); + return *i->string++; + } } - - /* If necessary, open the file. */ - if ( !i->file ) + else { - FILE * f = stdin; - if ( strcmp( i->fname, "-" ) && !( f = fopen( i->fname, "r" ) ) ) - perror( i->fname ); - i->file = f; - } + /* If necessary, open the file. */ + if ( !i->file ) + { + FILE * f = stdin; + if ( strcmp( i->fname, "-" ) && !( f = fopen( i->fname, "r" ) ) ) + perror( i->fname ); + i->file = f; + } - /* If there is another line in this file, start it. */ - if ( i->file && fgets( i->buf, sizeof( i->buf ), i->file ) ) - { - ++i->line; - i->string = i->buf; - return *i->string++; + /* If there is another line in this file, start it. */ + if ( i->file && fgets( i->buf, sizeof( i->buf ), i->file ) ) + { + ++i->line; + i->string = i->buf; + return *i->string++; + } } - next: - /* This include is done. Free it up and return EOF so yyparse() returns to * parse_file(). */