Use a collection to manage the segments.

git-svn-id: svn://svn.cc65.org/cc65/trunk@5124 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz
2011-08-05 13:45:33 +00:00
parent a17d11cba8
commit 9f02a29dfa
4 changed files with 95 additions and 94 deletions

View File

@@ -50,7 +50,7 @@
Span* NewSpan (struct Segment* Seg)
/* Create a new span. The segment is set to Seg, Start and End are set to the
/* Create a new span. The segment is set to Seg, Start and End are set to the
* current PC of the segment.
*/
{
@@ -73,19 +73,19 @@ void AddSpans (Collection* Spans)
* currently active segment will be inserted first with all others following.
*/
{
Segment* Seg;
unsigned I;
/* Add the currently active segment */
CollAppend (Spans, NewSpan (ActiveSeg));
/* Walk through the segment list and add all other segments */
Seg = SegmentList;
while (Seg) {
for (I = 0; I < CollCount (&SegmentList); ++I) {
Segment* Seg = CollAtUnchecked (&SegmentList, I);
/* Be sure to skip the active segment, since it was already added */
if (Seg != ActiveSeg) {
CollAppend (Spans, NewSpan (Seg));
}
Seg = Seg->List;
}
}