scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 1ce77f3c342d3c53596b39cd7271da9b21198813
parent 1679b6d153d6617c2049bc3bb79a4e5854fcb1cb
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Fri, 13 Jan 2017 15:05:47 +0100

[cc1] Avoid calling atoi() in every macro parameter

This was a debug loop which remained in this way.

Diffstat:
Mcc1/cpp.c | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/cc1/cpp.c b/cc1/cpp.c @@ -243,7 +243,7 @@ int expand(char *begin, Symbol *sym) { size_t elen; - int n; + int n, i; char *s = sym->u.s; char *arglist[NR_MACROARG], arguments[INPUTSIZ], buffer[INPUTSIZ]; @@ -259,10 +259,11 @@ expand(char *begin, Symbol *sym) if (!s) return 1; + n = atoi(s); if (!parsepars(arguments, arglist, atoi(s))) return 0; - for (n = 0; n < atoi(s); ++n) - DBG("MACRO par%d:%s", n, arglist[n]); + for (i = 0; i < n; ++i) + DBG("MACRO par%d:%s", i, arglist[i]); elen = copymacro(buffer, s+3, INPUTSIZ-1, arglist);