[hackers] [scc] [cc1] Remove linksym() || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Thu, 22 Dec 2016 15:27:06 +0100 (CET)

commit fae3ad2774b0663dc508cc9c8ac9f671fd2abc83
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Thu Dec 22 15:18:11 2016 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Thu Dec 22 15:18:11 2016 +0100

    [cc1] Remove linksym()
    
    This function was used only in newsym() and this new form
    makes the code more readable and compact.

diff --git a/cc1/symbol.c b/cc1/symbol.c
index 15a1876..9f67694 100644
--- a/cc1/symbol.c
+++ b/cc1/symbol.c
_AT_@ -136,23 +136,6 @@ newid(void)
         return id;
 }
 
-static Symbol *
-linksym(Symbol *sym)
-{
- Symbol *p, *prev;
-
- switch (sym->ns) {
- case NS_CPP:
- return sym;
- case NS_LABEL:
- sym->next = labels;
- return labels = sym;
- default:
- sym->next = head;
- return head = sym;
- }
-}
-
 Symbol *
 newsym(int ns, char *name)
 {
_AT_@ -169,8 +152,16 @@ newsym(int ns, char *name)
         sym->flags = 0;
         sym->u.s = NULL;
         sym->type = NULL;
- sym->next = sym->hash = NULL;
- return linksym(sym);
+ sym->hash = NULL;
+
+ if (ns == NS_LABEL) {
+ sym->next = labels;
+ labels = sym;
+ } else if (ns != NS_CPP) {
+ sym->next = head;
+ head = sym;
+ }
+ return sym;
 }
 
 static Symbol *
Received on Thu Dec 22 2016 - 15:27:06 CET

This archive was generated by hypermail 2.3.0 : Thu Dec 22 2016 - 15:36:26 CET