|
Boost-Commit : |
From: jurko.gospodnetic_at_[hidden]
Date: 2008-09-02 06:58:04
Author: jurko
Date: 2008-09-02 06:58:03 EDT (Tue, 02 Sep 2008)
New Revision: 48533
URL: http://svn.boost.org/trac/boost/changeset/48533
Log:
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.
Text files modified:
trunk/tools/jam/src/scan.c | 44 ++++++++++++++++++++--------------------
1 files changed, 22 insertions(+), 22 deletions(-)
Modified: trunk/tools/jam/src/scan.c
==============================================================================
--- trunk/tools/jam/src/scan.c (original)
+++ trunk/tools/jam/src/scan.c 2008-09-02 06:58:03 EDT (Tue, 02 Sep 2008)
@@ -129,33 +129,33 @@
/* 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().
*/
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk