Export NewSpan() - this will be needed later.

git-svn-id: svn://svn.cc65.org/cc65/trunk@5206 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz
2011-08-18 11:57:17 +00:00
parent 4160505c59
commit 11d46e93b2
2 changed files with 14 additions and 13 deletions

View File

@@ -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 */ /* Create and return a new span */
{ {
/* Allocate memory */ /* Allocate memory */
Span* S = xmalloc (sizeof (*S)); Span* S = xmalloc (sizeof (*S));
/* Initialize the fields */ /* Initialize the fields */
S->Id = Id; S->Id = CollCount (&Obj->Spans);
S->Sec = SecId; S->Sec = SecId;
S->Offs = Offs; S->Offs = Offs;
S->Size = Size; S->Size = Size;
/* Insert it into the collection of all spans of this object file */
CollAppend (&Obj->Spans, S);
/* Return the result */ /* Return the result */
return S; return S;
} }
@@ -87,17 +90,11 @@ static Span* NewSpan (unsigned Id, unsigned SecId, unsigned long Offs, unsigned
Span* ReadSpan (FILE* F, ObjData* O) Span* ReadSpan (FILE* F, ObjData* O)
/* Read a Span from a file and return it */ /* 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 SecId = ReadVar (F);
unsigned long Offs = ReadVar (F); unsigned long Offs = ReadVar (F);
unsigned Size = ReadVar (F); unsigned Size = ReadVar (F);
Span* S = NewSpan (CollCount (&O->Spans), SecId, Offs, Size); return NewSpan (O, SecId, Offs, Size);
/* Insert it into the collection of all spans of this object file */
CollAppend (&O->Spans, S);
/* And return it */
return S;
} }

View File

@@ -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); Span* ReadSpan (FILE* F, struct ObjData* O);
/* Read a Span from a file and return it */ /* Read a Span from a file and return it */