From: uz Date: Thu, 18 Aug 2011 11:57:17 +0000 (+0000) Subject: Export NewSpan() - this will be needed later. X-Git-Tag: V2.13.3~256 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=11d46e93b21a0f427def0f3052fb4314613e0792;p=cc65 Export NewSpan() - this will be needed later. git-svn-id: svn://svn.cc65.org/cc65/trunk@5206 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/ld65/span.c b/src/ld65/span.c index 480e12433..68c505951 100644 --- a/src/ld65/span.c +++ b/src/ld65/span.c @@ -66,18 +66,21 @@ struct Span { -static Span* NewSpan (unsigned Id, unsigned SecId, unsigned long Offs, unsigned long Size) +Span* NewSpan (ObjData* Obj, unsigned SecId, unsigned long Offs, unsigned long Size) /* Create and return a new span */ { /* Allocate memory */ Span* S = xmalloc (sizeof (*S)); /* Initialize the fields */ - S->Id = Id; + S->Id = CollCount (&Obj->Spans); S->Sec = SecId; S->Offs = Offs; S->Size = Size; + /* Insert it into the collection of all spans of this object file */ + CollAppend (&Obj->Spans, S); + /* Return the result */ return S; } @@ -87,17 +90,11 @@ static Span* NewSpan (unsigned Id, unsigned SecId, unsigned long Offs, unsigned Span* ReadSpan (FILE* F, ObjData* O) /* Read a Span from a file and return it */ { - /* Create a new Span */ + /* Create a new Span and return it */ unsigned SecId = ReadVar (F); unsigned long Offs = ReadVar (F); unsigned Size = ReadVar (F); - Span* S = NewSpan (CollCount (&O->Spans), SecId, Offs, Size); - - /* Insert it into the collection of all spans of this object file */ - CollAppend (&O->Spans, S); - - /* And return it */ - return S; + return NewSpan (O, SecId, Offs, Size); } @@ -178,9 +175,9 @@ void PrintDbgSpans (FILE* F) /* Output the data */ fprintf (F, "span\tid=%u,seg=%u,start=%lu,size=%lu\n", - O->SpanBaseId + S->Id, - Sec->Seg->Id, - Sec->Offs + S->Offs, + O->SpanBaseId + S->Id, + Sec->Seg->Id, + Sec->Offs + S->Offs, S->Size); } } diff --git a/src/ld65/span.h b/src/ld65/span.h index 335344ff1..54726f6de 100644 --- a/src/ld65/span.h +++ b/src/ld65/span.h @@ -73,6 +73,10 @@ typedef struct Span Span; +Span* NewSpan (struct ObjData* Obj, unsigned SecId, unsigned long Offs, + unsigned long Size); +/* Create and return a new span */ + Span* ReadSpan (FILE* F, struct ObjData* O); /* Read a Span from a file and return it */