shithub: mc

Download patch

ref: 46f0325e0e0d5e49b6bcf926e45449f3397eaa47
parent: 2bb2b35d3e99d90fdcb026c886c2fc20d805ef7f
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Jun 27 10:50:30 EDT 2015

Fix a few minor issues post refactor.

    - We should nop on free(NULL).
    - We shouldn't bother with the 'g' suffix on locals.

--- a/6/blob.c
+++ b/6/blob.c
@@ -75,6 +75,8 @@
 {
     size_t i;
 
+    if (!b)
+        return;
     switch (b->type) {
         case Btref:
             free(b->lbl);
--- a/6/gengas.c
+++ b/6/gengas.c
@@ -322,8 +322,8 @@
         return;
     if (b->lbl) {
         if (b->isglobl)
-            fprintf(fd, ".globl %s%sg\n", Symprefix, b->lbl);
-        fprintf(fd, "%s%s%s:\n", Symprefix, b->lbl, b->isglobl ? "g" : "");
+            fprintf(fd, ".globl %s%s\n", Symprefix, b->lbl);
+        fprintf(fd, "%s%s:\n", Symprefix, b->lbl);
     }
     switch (b->type) {
         case Bti8:
@@ -342,7 +342,7 @@
             encodemin(fd, b->ival);
             break;
         case Btref:
-            fprintf(fd, "\t.quad %s%s + %zd\n", b->ref.str, b->ref.isextern ? "g" : "", b->ref.off);
+            fprintf(fd, "\t.quad %s + %zd\n", b->ref.str, b->ref.off);
             break;
         case Btbytes:
             writebytes(fd, b->bytes.buf, b->bytes.len);