mirror of
https://github.com/cc65/cc65.git
synced 2024-09-29 17:56:21 +00:00
Use CollTransfer where possible.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5225 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
189a9bfb38
commit
88774521a3
@ -271,17 +271,13 @@ void DoneLineInfo (void)
|
|||||||
void EndLine (LineInfo* LI)
|
void EndLine (LineInfo* LI)
|
||||||
/* End a line that is tracked by the given LineInfo structure */
|
/* End a line that is tracked by the given LineInfo structure */
|
||||||
{
|
{
|
||||||
unsigned I;
|
|
||||||
|
|
||||||
/* Close the spans for the line */
|
/* Close the spans for the line */
|
||||||
CloseSpans (&LI->OpenSpans);
|
CloseSpans (&LI->OpenSpans);
|
||||||
|
|
||||||
/* Move the spans to the list of all spans for this line, then clear the
|
/* Move the spans to the list of all spans for this line, then clear the
|
||||||
* list of open spans.
|
* list of open spans.
|
||||||
*/
|
*/
|
||||||
for (I = 0; I < CollCount (&LI->OpenSpans); ++I) {
|
CollTransfer (&LI->Spans, &LI->OpenSpans);
|
||||||
CollAppend (&LI->Spans, CollAtUnchecked (&LI->OpenSpans, I));
|
|
||||||
}
|
|
||||||
CollDeleteAll (&LI->OpenSpans);
|
CollDeleteAll (&LI->OpenSpans);
|
||||||
|
|
||||||
/* Line info is no longer active - remove it from the list of current
|
/* Line info is no longer active - remove it from the list of current
|
||||||
@ -376,23 +372,13 @@ void GetFullLineInfo (Collection* LineInfos)
|
|||||||
{
|
{
|
||||||
unsigned I;
|
unsigned I;
|
||||||
|
|
||||||
/* If the collection is currently empty, grow it as necessary */
|
/* Bum the reference counter for all active line infos */
|
||||||
if (CollCount (LineInfos) == 0) {
|
|
||||||
CollGrow (LineInfos, CollCount (&CurLineInfo));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Copy all valid line infos to the collection */
|
|
||||||
for (I = 0; I < CollCount (&CurLineInfo); ++I) {
|
for (I = 0; I < CollCount (&CurLineInfo); ++I) {
|
||||||
|
++((LineInfo*)CollAt (&CurLineInfo, I))->RefCount;
|
||||||
/* Get the line info from the slot */
|
|
||||||
LineInfo* LI = CollAt (&CurLineInfo, I);
|
|
||||||
|
|
||||||
/* Bump the reference counter */
|
|
||||||
++LI->RefCount;
|
|
||||||
|
|
||||||
/* Return it to the caller */
|
|
||||||
CollAppend (LineInfos, LI);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Copy all line infos over */
|
||||||
|
CollTransfer (LineInfos, &CurLineInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -419,6 +419,9 @@ void SymExport (SymEntry* S, unsigned char AddrSize, unsigned Flags)
|
|||||||
|
|
||||||
/* Set the symbol data */
|
/* Set the symbol data */
|
||||||
S->Flags |= (SF_EXPORT | SF_REFERENCED | Flags);
|
S->Flags |= (SF_EXPORT | SF_REFERENCED | Flags);
|
||||||
|
|
||||||
|
/* Remember line info for this reference */
|
||||||
|
CollAppend (&S->RefLines, GetAsmLineInfo ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -503,11 +503,9 @@ static void SymCheckUndefined (SymEntry* S)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (S->Flags & SF_REFERENCED) {
|
if (S->Flags & SF_REFERENCED) {
|
||||||
unsigned I;
|
/* Mark as referenced and move the line info */
|
||||||
Sym->Flags |= SF_REFERENCED;
|
Sym->Flags |= SF_REFERENCED;
|
||||||
for (I = 0; I < CollCount (&S->RefLines); ++I) {
|
CollTransfer (&Sym->RefLines, &S->RefLines);
|
||||||
CollAppend (&Sym->RefLines, CollAtUnchecked (&S->RefLines, I));
|
|
||||||
}
|
|
||||||
CollDeleteAll (&S->RefLines);
|
CollDeleteAll (&S->RefLines);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -564,9 +562,11 @@ void SymCheck (void)
|
|||||||
*/
|
*/
|
||||||
if (S->Flags & SF_GLOBAL) {
|
if (S->Flags & SF_GLOBAL) {
|
||||||
if (S->Flags & SF_DEFINED) {
|
if (S->Flags & SF_DEFINED) {
|
||||||
SymExportFromGlobal (S);
|
printf ("ExportFromGlobal: %s\n", SB_GetConstBuf (GetSymName (S)));
|
||||||
} else {
|
SymExportFromGlobal (S);
|
||||||
SymImportFromGlobal (S);
|
} else {
|
||||||
|
printf ("ImportFromGlobal: %s\n", SB_GetConstBuf (GetSymName (S)));
|
||||||
|
SymImportFromGlobal (S);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user