mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
examples: don't promote unchecked function calls
* etc/bench.pl.in, examples/c/bistromathic/parse.y, * examples/c/calc/calc.y, examples/c/pushcalc/calc.y: Check scanf's return value. * doc/bison.texi: Likewise, but only for the second example, to avoid cluttering the very simple case.
This commit is contained in:
@@ -498,7 +498,8 @@ yylex (void)
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
{
|
||||
int nchars = 0;
|
||||
sscanf (input - 1, "%d%n", &yylval.NUM, &nchars);
|
||||
int n = sscanf (input - 1, "%d%n", &yylval.NUM, &nchars);
|
||||
assert (n == 1);
|
||||
input += nchars - 1;
|
||||
return NUM;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user