/* Segment list */
-SegDesc* SegDescList; /* Single linked list */
-unsigned SegDescCount; /* Number of entries in list */
+static Collection SegDescList = STATIC_COLLECTION_INITIALIZER;
/* Segment attributes */
#define SA_TYPE 0x0001
{
unsigned I;
for (I = 0; I < CollCount (&MemoryList); ++I) {
- Memory* M = CollAt (&MemoryList, I);
+ Memory* M = CollAtUnchecked (&MemoryList, I);
if (M->Name == Name) {
return M;
}
static SegDesc* CfgFindSegDesc (unsigned Name)
/* Find the segment descriptor with the given name, return NULL if not found. */
{
- SegDesc* S = SegDescList;
- while (S) {
+ unsigned I;
+ for (I = 0; I < CollCount (&SegDescList); ++I) {
+ SegDesc* S = CollAtUnchecked (&SegDescList, I);
if (S->Name == Name) {
/* Found */
return S;
}
- S = S->Next;
}
/* Not found */
/* Insert a segment descriptor into the list of segment descriptors */
{
/* Insert the struct into the list */
- S->Next = SegDescList;
- SegDescList = S;
- ++SegDescCount;
+ CollAppend (&SegDescList, S);
}
/* Initialize the fields */
S->Name = Name;
- S->Next = 0;
S->Seg = Seg;
S->Attr = 0;
S->Flags = 0;
/* No output file. Walk through the list and mark all segments
* loading into these memory areas in this file as dumped.
- */
+ */
unsigned J;
for (J = 0; J < CollCount (&F->MemList); ++J) {
typedef struct SegDesc SegDesc;
struct SegDesc {
unsigned Name; /* Index of the name */
- SegDesc* Next; /* Pointer to next entry in list */
Segment* Seg; /* Pointer to segment structure */
unsigned Attr; /* Attributes for segment */
unsigned Flags; /* Set of bitmapped flags */
unsigned char AlignLoad; /* Load area alignment if given */
};
-/* Segment list */
-extern SegDesc* SegDescList; /* Single linked list */
-extern unsigned SegDescCount; /* Number of entries in list */
-
/* Memory flags */
#define MF_DEFINE 0x0001 /* Define start and size */
#define MF_FILL 0x0002 /* Fill segment */