summary refs log tree commit diff
path: root/alias.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin@c9x.me>2017-05-17 09:40:07 -0400
committerQuentin Carbonneaux <quentin@c9x.me>2017-05-17 10:05:28 -0400
commita3a1451c5fabb5c94f7fbeb13fdc6b1e2c23181f (patch)
tree1fb1ba60e8f3cab09c629ce9dd63e00e01974c39 /alias.c
parent2d02070af019e9896ecf2a63bedc098092fd395d (diff)
downloadroux-a3a1451c5fabb5c94f7fbeb13fdc6b1e2c23181f.tar.gz
intern symbol names
Symbols in the source file are still limited in
length because the rest of the code assumes that
strings always fit in NString bytes.

Regardless, there is already a benefit because
comparing/copying symbol names does not require
using strcmp()/strcpy() anymore.
Diffstat (limited to 'alias.c')
-rw-r--r--alias.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/alias.c b/alias.c
index 77d5d73..66c12e5 100644
--- a/alias.c
+++ b/alias.c
@@ -18,7 +18,7 @@ getalias(Alias *a, Ref r, Fn *fn)
 		c = &fn->con[r.val];
 		if (c->type == CAddr) {
 			a->type = ASym;
-			strcpy(a->label, c->label);
+			a->label = c->label;
 		} else
 			a->type = ACon;
 		a->offset = c->bits.i;
@@ -51,7 +51,7 @@ alias(Ref p, int sp, Ref q, int sq, int *delta, Fn *fn)
 		/* they conservatively alias if the
 		 * symbols are different, or they
 		 * alias for sure if they overlap */
-		if (strcmp(ap.label, aq.label) != 0)
+		if (ap.label != aq.label)
 			return MayAlias;
 		if (ovlap)
 			return MustAlias;