]> git.sur5r.net Git - cc65/blobdiff - src/cc65/codelab.c
When using GetQualifier, pass correct params :-)
[cc65] / src / cc65 / codelab.c
index e4fdef46efba139eb678f4b61dcd6834bc75cb28..9e3b93765f64ebf69b57dd13a45433e4d7b1ec6d 100644 (file)
@@ -6,10 +6,10 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2001     Ullrich von Bassewitz                                        */
-/*              Wacholderweg 14                                              */
-/*              D-70597 Stuttgart                                            */
-/* EMail:       uz@musoftware.de                                             */
+/* (C) 2001-2009, Ullrich von Bassewitz                                      */
+/*                Roemerstrasse 52                                           */
+/*                D-70794 Filderstadt                                        */
+/* EMail:         uz@cc65.org                                                */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
@@ -40,6 +40,7 @@
 /* cc65 */
 #include "codeent.h"
 #include "codelab.h"
+#include "output.h"
 
 
 
@@ -89,6 +90,9 @@ void CL_AddRef (CodeLabel* L, struct CodeEntry* E)
     /* The insn at E jumps to this label */
     E->JumpTo = L;
 
+    /* Replace the code entry argument with the name of the new label */
+    CE_SetArg (E, L->Name);
+
     /* Remember that in the label */
     CollAppend (&L->JumpFrom, E);
 }
@@ -101,11 +105,11 @@ void CL_MoveRefs (CodeLabel* OldLabel, CodeLabel* NewLabel)
  */
 {
     /* Walk through all instructions referencing the old label */
-    unsigned Count = CollCount (&OldLabel->JumpFrom);
+    unsigned Count = CL_GetRefCount (OldLabel);
     while (Count--) {
 
        /* Get the instruction that references the old label */
-       CodeEntry* E = CollAt (&OldLabel->JumpFrom, Count);
+       CodeEntry* E = CL_GetRef (OldLabel, Count);
 
        /* Change the reference to the new label */
        CHECK (E->JumpTo == OldLabel);
@@ -119,11 +123,16 @@ void CL_MoveRefs (CodeLabel* OldLabel, CodeLabel* NewLabel)
 
 
 
-void CL_Output (const CodeLabel* L, FILE* F)
-/* Output the code label to a file */
+void CL_Output (const CodeLabel* L)
+/* Output the code label to the output file */
 {
-    fprintf (F, "%s:", L->Name);
+    WriteOutput ("%s:", L->Name);
+    if (strlen (L->Name) > 6) {
+       /* Label is too long, add a linefeed */
+       WriteOutput ("\n");
+    }
 }
 
 
 
+