ref: b949267ae25f86333ceaba22e473deb822b4be23
parent: bf7035e84c924246113e6d6033b3513bd224f559
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri May 22 06:45:00 EDT 2015
Simplify parseargs() in cc1
--- a/cc1/cpp.c
+++ b/cc1/cpp.c
@@ -19,20 +19,19 @@
static char *
parseargs(char *s, char *args[NR_MACROARG], int *nargs)
{
- unsigned n ;
+ int n;
size_t len;
char *endp, c;
- if (*s != '(') {
- *nargs = -1;
- return s;
- }
- if (*++s == ')') {
- *nargs = 0;
- return s+1;
- }
+ n = -1;
+ if (*s != '(')
+ goto set_nargs;
+ n = 0;
+ while (isspace(*s++))
+ /* nothing */;
+ if (*s == ')')
+ goto set_nargs;
-
for (n = 1; n <= NR_MACROARG; ++n) {
while (isspace(*s))
++s;
@@ -56,6 +55,8 @@
}
if (n > NR_MACROARG)
error("too much parameters in macro");
+
+set_nargs:
*nargs = n;
return s;
}