shithub: scc

Download patch

ref: fbf8bb861d0aa96307dec739ca80167b689d5ab2
parent: d445c02b0d677bee2357da71b8e65aa0c1200286
author: Roberto E. Vargas Caballero <[email protected]>
date: Fri Jan 13 10:05:47 EST 2017

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

This was a debug loop which remained in this way.

--- a/cc1/cpp.c
+++ b/cc1/cpp.c
@@ -243,7 +243,7 @@
 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 @@
 	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);