void EndLine (LineInfo* LI)
/* End a line that is tracked by the given LineInfo structure */
{
- unsigned I;
-
/* Close the spans for the line */
CloseSpans (&LI->OpenSpans);
/* Move the spans to the list of all spans for this line, then clear the
* list of open spans.
*/
- for (I = 0; I < CollCount (&LI->OpenSpans); ++I) {
- CollAppend (&LI->Spans, CollAtUnchecked (&LI->OpenSpans, I));
- }
+ CollTransfer (&LI->Spans, &LI->OpenSpans);
CollDeleteAll (&LI->OpenSpans);
/* Line info is no longer active - remove it from the list of current
{
unsigned I;
- /* If the collection is currently empty, grow it as necessary */
- if (CollCount (LineInfos) == 0) {
- CollGrow (LineInfos, CollCount (&CurLineInfo));
- }
-
- /* Copy all valid line infos to the collection */
+ /* Bum the reference counter for all active line infos */
for (I = 0; I < CollCount (&CurLineInfo); ++I) {
-
- /* 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);
+ ++((LineInfo*)CollAt (&CurLineInfo, I))->RefCount;
}
+
+ /* Copy all line infos over */
+ CollTransfer (LineInfos, &CurLineInfo);
}
}
}
if (S->Flags & SF_REFERENCED) {
- unsigned I;
+ /* Mark as referenced and move the line info */
Sym->Flags |= SF_REFERENCED;
- for (I = 0; I < CollCount (&S->RefLines); ++I) {
- CollAppend (&Sym->RefLines, CollAtUnchecked (&S->RefLines, I));
- }
+ CollTransfer (&Sym->RefLines, &S->RefLines);
CollDeleteAll (&S->RefLines);
}
*/
if (S->Flags & SF_GLOBAL) {
if (S->Flags & SF_DEFINED) {
- SymExportFromGlobal (S);
- } else {
- SymImportFromGlobal (S);
+ printf ("ExportFromGlobal: %s\n", SB_GetConstBuf (GetSymName (S)));
+ SymExportFromGlobal (S);
+ } else {
+ printf ("ImportFromGlobal: %s\n", SB_GetConstBuf (GetSymName (S)));
+ SymImportFromGlobal (S);
}
}