]> git.sur5r.net Git - cc65/blobdiff - src/ca65/lineinfo.c
New version by Greg King.
[cc65] / src / ca65 / lineinfo.c
index 3abfd6e3fedafebde5535428e77b766f2a0497d4..6f81beaafc5eb28fca50b0d6b764016c209aaab4 100644 (file)
@@ -129,7 +129,8 @@ void ClearLineInfo (void)
 
 
 
-static int CmpLineInfo (void* Data, const void* LI1_, const void* LI2_)
+static int CmpLineInfo (void* Data attribute ((unused)), 
+                       const void* LI1_, const void* LI2_)
 /* Compare function for the sort */
 {
     /* Cast the pointers */
@@ -161,13 +162,22 @@ static int CmpLineInfo (void* Data, const void* LI1_, const void* LI2_)
     }
 }
 
-
+                                                          
 
 void MakeLineInfoIndex (void)
 /* Sort the line infos and drop all unreferenced ones */
 {
+    unsigned I;
+
     /* Sort the collection */
     CollSort (&LineInfoColl, CmpLineInfo, 0);
+
+    /* Walk over the list and index the line infos. */
+    for (I = 0; I < LineInfoValid; ++I) {
+       /* Get a pointer to this line info */
+       LineInfo* LI = CollAtUnchecked (&LineInfoColl, I);
+       LI->Index = I;
+    }
 }
 
 
@@ -203,6 +213,9 @@ void WriteLineInfo (void)
        ObjWriteVar (0);
 
     }
+
+    /* End of line infos */
+    ObjEndLineInfos ();
 }