|
|
|
@ -346,6 +346,39 @@ VOID SectionCollectLinesForVariable(SECTIONPTR abstractSection, CONST_STRPTR var |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
VOID SectionRemoveLinesForVariable(SECTIONPTR abstractSection, CONST_STRPTR varKey) |
|
|
|
|
{ |
|
|
|
|
struct Section* section = (struct Section*)abstractSection; |
|
|
|
|
if( section != NULL ) |
|
|
|
|
{ |
|
|
|
|
ULONG lineCount = SizeOfArray(section->lines); |
|
|
|
|
ULONG index = 0; |
|
|
|
|
LineArray newLineArray = LineArrayNew(); |
|
|
|
|
STRPTR normalizedKey = AllocVec(strlen(varKey)+1, MEMF_CLEAR); |
|
|
|
|
CopyMem(varKey, normalizedKey, strlen(varKey)); |
|
|
|
|
downcaseString(normalizedKey); |
|
|
|
|
|
|
|
|
|
for( index = 0; index < lineCount; index++ ) |
|
|
|
|
{ |
|
|
|
|
// instead of compacting, we save lines that dont match, and free lines that do
|
|
|
|
|
LINEPTR line = LineArrayValues(section->lines)[index]; |
|
|
|
|
if( LineHasVariable(line, normalizedKey) ) |
|
|
|
|
{ |
|
|
|
|
LineFree(line); |
|
|
|
|
LineArrayValues(section->lines)[index] = NULL; // dont crash when we cann LineArrayFree
|
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
LineArrayAppend(newLineArray, line); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
LineArrayFree(section->lines, FALSE);//dont free the lines, the newArray will do that later
|
|
|
|
|
section->lines = newLineArray; |
|
|
|
|
FreeVec(normalizedKey);
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VOID SectionDump(SECTIONPTR abstractSection) |
|
|
|
|
{ |
|
|
|
|
struct Section* section = (struct Section*)abstractSection; |
|
|
|
|