|
|
|
@ -15,7 +15,6 @@ |
|
|
|
|
|
|
|
|
|
#define ZERO ((BPTR)0) |
|
|
|
|
|
|
|
|
|
STATIC SECTIONPTR findOrCreateSection(SECTIONSTOREPTR sectionStore, CONST_STRPTR compoundKey); |
|
|
|
|
STATIC LINEPTR configFileReadLine(BPTR file); |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -213,7 +212,7 @@ VOID ConfigFileAddVariable(CONFIGFILEPTR abstractConfigFile, CONST_STRPTR compou |
|
|
|
|
StringArrayFree(canonicalParts, TRUE); |
|
|
|
|
|
|
|
|
|
// now get the section
|
|
|
|
|
section = findOrCreateSection(configFile->sectionStore, compoundKey); |
|
|
|
|
section = SectionStoreFindOrCreateSection(configFile->sectionStore, compoundKey); |
|
|
|
|
// add the line to the section
|
|
|
|
|
SectionAddLine(section, line);
|
|
|
|
|
} |
|
|
|
@ -333,27 +332,3 @@ STATIC LINEPTR configFileReadLine(BPTR file) |
|
|
|
|
FreeVec(buffer); |
|
|
|
|
return result;
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
STATIC SECTIONPTR findOrCreateSection(SECTIONSTOREPTR sectionStore, CONST_STRPTR compoundKey) |
|
|
|
|
{ |
|
|
|
|
// now get the section
|
|
|
|
|
StringArray canonicalParts = ConfigFileSplitKeyForVar(compoundKey); |
|
|
|
|
SECTIONPTR section = section = SectionStoreGetSection(sectionStore, StringArrayValues(canonicalParts)[0]); |
|
|
|
|
if( section == NULL ) |
|
|
|
|
{ |
|
|
|
|
StringArray separateParts = ConfigFileSplitKeyCompletely(compoundKey); |
|
|
|
|
CONST_STRPTR sectionLineText = NULL; |
|
|
|
|
LINEPTR sectionLine = NULL; |
|
|
|
|
|
|
|
|
|
section = SectionCreateWithNameAndSubname(StringArrayValues(separateParts)[0], StringArrayValues(separateParts)[1]); |
|
|
|
|
sectionLineText = SectionSerialize(section); |
|
|
|
|
sectionLine = LineNew(sectionLineText); |
|
|
|
|
SectionAddSectionLine(section, sectionLine); |
|
|
|
|
FreeVec((STRPTR)sectionLineText); |
|
|
|
|
SectionStoreAddSection(sectionStore, section); //section store will free it for us
|
|
|
|
|
StringArrayFree(separateParts, TRUE); |
|
|
|
|
} |
|
|
|
|
StringArrayFree(canonicalParts, TRUE); |
|
|
|
|
return section; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|