1
0
mirror of https://github.com/cc65/cc65.git synced 2024-07-03 06:29:36 +00:00

More collection usage.

git-svn-id: svn://svn.cc65.org/cc65/trunk@4794 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2010-08-08 15:23:22 +00:00
parent ad140bede4
commit fedb265a22
2 changed files with 7 additions and 16 deletions

View File

@ -98,8 +98,7 @@ static Collection MemoryList = STATIC_COLLECTION_INITIALIZER;
/* 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
@ -179,7 +178,7 @@ static Memory* CfgFindMemory (unsigned Name)
{
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;
}
@ -204,13 +203,13 @@ static Memory* CfgGetMemory (unsigned Name)
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 */
@ -223,9 +222,7 @@ static void SegDescInsert (SegDesc* S)
/* 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);
}
@ -331,7 +328,6 @@ static SegDesc* NewSegDesc (unsigned Name)
/* Initialize the fields */
S->Name = Name;
S->Next = 0;
S->Seg = Seg;
S->Attr = 0;
S->Flags = 0;
@ -1744,7 +1740,7 @@ void CfgWriteTarget (void)
/* 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) {

View File

@ -88,7 +88,6 @@ struct Memory {
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 */
@ -99,10 +98,6 @@ struct SegDesc {
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 */