[hackers] [scc] Fix nextsym() || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Sun, 27 Sep 2015 10:29:14 +0200 (CEST)

commit b84e1437a4a054d68f3b49fc908580939a795247
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Sun Sep 27 10:23:33 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Sun Sep 27 10:23:33 2015 +0200

    Fix nextsym()
    
    Nextsym() is used when a macro with arguments is found without arguments,
    and it is needed to look for a definition with less priority. There were
    two different errors in nextsym(), because in case of finding the less
    priority symbol it was returning the more priority, and in case of not
    finding a less priority symbol it was installing a new symbol, but it
    should be only allocated.

diff --git a/cc1/symbol.c b/cc1/symbol.c
index 318311a..3ecb2d9 100644
--- a/cc1/symbol.c
+++ b/cc1/symbol.c
_AT_@ -281,9 +281,9 @@ nextsym(Symbol *sym, int ns)
         for (p = sym->hash; p; p = p->hash) {
                 t = p->name;
                 if (c == *t && !strcmp(s, t))
- return sym;
+ return p;
         }
- return linkhash(allocsym(ns, s));
+ return allocsym(ns, s);
 }
 
 Symbol *
Received on Sun Sep 27 2015 - 10:29:14 CEST

This archive was generated by hypermail 2.3.0 : Sun Sep 27 2015 - 10:36:14 CEST