[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
tests: remove useless feature
From: |
Akim Demaille |
Subject: |
tests: remove useless feature |
Date: |
Thu, 18 Apr 2019 06:45:33 +0200 |
commit 2f3d9717ee6dea238d201dfc457a4cc596bc6de4
Author: Akim Demaille <address@hidden>
Date: Wed Apr 17 08:43:53 2019 +0200
tests: remove useless feature
* tests/calc.at (read_signed_integer): Rename as...
(read_integer): this.
We never read signs here.
diff --git a/tests/calc.at b/tests/calc.at
index 99f1160c..6331374d 100644
--- a/tests/calc.at
+++ b/tests/calc.at
@@ -220,28 +220,21 @@ unget_char (]AT_YYLEX_PRE_FORMALS[ int c)
}
static int
-read_signed_integer (]AT_YYLEX_FORMALS[)
+read_integer (]AT_YYLEX_FORMALS[)
{
int c = get_char (]AT_YYLEX_ARGS[);
- int sign = 1;
- int n = 0;
+ int res = 0;
]AT_USE_LEX_ARGS[;
- if (c == '-')
- {
- c = get_char (]AT_YYLEX_ARGS[);
- sign = -1;
- }
-
while (isdigit (c))
{
- n = 10 * n + (c - '0');
+ res = 10 * res + (c - '0');
c = get_char (]AT_YYLEX_ARGS[);
}
unget_char (]AT_YYLEX_PRE_ARGS[ c);
- return sign * n;
+ return res;
}
@@ -268,7 +261,7 @@ read_signed_integer (]AT_YYLEX_FORMALS[)
if (c == '.' || isdigit (c))
{
unget_char (]AT_YYLEX_PRE_ARGS[ c);
- ]AT_VAL[.ival = read_signed_integer (]AT_YYLEX_ARGS[);
+ ]AT_VAL[.ival = read_integer (]AT_YYLEX_ARGS[);
return ]AT_TOKEN_PREFIX[NUM;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- tests: remove useless feature,
Akim Demaille <=