commit 1ce77f3c342d3c53596b39cd7271da9b21198813
Author:     Roberto E. Vargas Caballero <k...@shike2.com>
AuthorDate: Fri Jan 13 15:05:47 2017 +0100
Commit:     Roberto E. Vargas Caballero <k...@shike2.com>
CommitDate: Fri Jan 13 15:05:47 2017 +0100

    [cc1] Avoid calling atoi() in every macro parameter
    
    This was a debug loop which remained in this way.

diff --git a/cc1/cpp.c b/cc1/cpp.c
index 63dc281..eb98fcc 100644
--- 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);
 

Reply via email to