[hackers] [scc] [cc2] Avoid name collision || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Mon, 9 May 2016 21:10:45 +0200 (CEST)

commit 13ce3ce2a3c0bd19452d9bdbe9669a62382a44a0
Author: Roberto E. Vargas Caballero <Roberto E. Vargas Caballero>
AuthorDate: Sun May 8 19:19:44 2016 +0200
Commit: Roberto E. Vargas Caballero <Roberto E. Vargas Caballero>
CommitDate: Sun May 8 19:19:44 2016 +0200

    [cc2] Avoid name collision
    
    Label() was a name used in several ports, so it is
    not a good idea to define it again in the global
    namespace. Label2node() is also a good name.

diff --git a/cc2/arch/qbe/cgen.c b/cc2/arch/qbe/cgen.c
index 704a7c4..3af006d 100644
--- a/cc2/arch/qbe/cgen.c
+++ b/cc2/arch/qbe/cgen.c
_AT_@ -351,13 +351,13 @@ cgen(Node *np)
                         sym->kind = SLABEL;
                         next->label = sym;
                 }
- ifyes = label(np->u.sym);
- ifno = label(next->label);
+ ifyes = label2node(np->u.sym);
+ ifno = label2node(next->label);
                 op = ASBRANCH;
                 np = np->left;
                 goto emit_jump;
         case OJMP:
- ifyes = label(np->u.sym);
+ ifyes = label2node(np->u.sym);
                 op = ASJMP;
                 np = ifno = NULL;
         emit_jump:
diff --git a/cc2/cc2.h b/cc2/cc2.h
index fee484a..4dbbd45 100644
--- a/cc2/cc2.h
+++ b/cc2/cc2.h
_AT_@ -202,7 +202,7 @@ extern void writeout(void), endinit(void), newfun(void);
 extern void code(int op, Node *to, Node *from1, Node *from2);
 extern void defvar(Symbol *), defpar(Symbol *), defglobal(Symbol *);
 extern void setlabel(Symbol *sym);
-extern Node *label(Symbol *sym);
+extern Node *label2node(Symbol *sym);
 
 /* node.c */
 #define SETCUR 1
diff --git a/cc2/code.c b/cc2/code.c
index a29819a..7132291 100644
--- a/cc2/code.c
+++ b/cc2/code.c
_AT_@ -53,7 +53,7 @@ addr(Node *np, Addr *addr)
 }
 
 Node *
-label(Symbol *sym)
+label2node(Symbol *sym)
 {
         Node *np;
 
Received on Mon May 09 2016 - 21:10:45 CEST

This archive was generated by hypermail 2.3.0 : Mon May 09 2016 - 21:12:15 CEST