2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-16 01:12:13 +00:00

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]
This commit is contained in:
Jurko Gospodnetić
2008-09-02 10:58:03 +00:00
parent 0c0955ab0a
commit 42280c7a0f

View File

@@ -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().
*/