[hackers] [scc] [cc1] Fix bug in dumpstab() || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Fri, 3 Mar 2017 10:40:54 +0100 (CET)

commit ee4761d6223d09d9fe13af32f3ba31722bbb44c1
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Wed Mar 1 17:06:03 2017 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Fri Mar 3 10:40:46 2017 +0100

    [cc1] Fix bug in dumpstab()
    
    The size of the tables is different now, so we need a if-else chain
    to get the correct size of the table.

diff --git a/cc1/symbol.c b/cc1/symbol.c
index 7f8b602..97a34d8 100644
--- a/cc1/symbol.c
+++ b/cc1/symbol.c
_AT_@ -27,9 +27,19 @@ void
 dumpstab(Symbol **tbl, char *msg)
 {
         Symbol **bp, *sym;
+ unsigned size;
 
         fprintf(stderr, "Symbol Table dump at ctx=%u\n%s\n", curctx, msg);
- for (bp = tbl; bp < &tbl[NR_SYM_HASH]; ++bp) {
+ if (tbl == htab)
+ size = NR_SYM_HASH;
+ else if (tbl == htabcpp)
+ size = NR_CPP_HASH;
+ else if (tbl == htablbl)
+ size = NR_LBL_HASH;
+ else
+ abort();
+
+ for (bp = tbl; bp < &tbl[size]; ++bp) {
                 if (*bp == NULL)
                         continue;
                 fprintf(stderr, "%d", (int) (bp - htab));
Received on Fri Mar 03 2017 - 10:40:54 CET

This archive was generated by hypermail 2.3.0 : Fri Mar 03 2017 - 10:48:22 CET