diff --git a/components/codetools/linkscanner.pas b/components/codetools/linkscanner.pas index de8d99e30d..f5995b94ca 100644 --- a/components/codetools/linkscanner.pas +++ b/components/codetools/linkscanner.pas @@ -283,7 +283,7 @@ type FCompilerModeSwitch: TCompilerModeSwitch; FPascalCompiler: TPascalCompiler; FMacros: PSourceLinkMakro; - FMacroCount: integer; + FMacroCount, fMacroCapacity: integer; procedure SetCompilerMode(const AValue: TCompilerMode); procedure SetCompilerModeSwitch(const AValue: TCompilerModeSwitch); procedure SkipTillEndifElse(SkippingUntil: TLSSkippingDirective); @@ -3041,14 +3041,32 @@ end; procedure TLinkScanner.AddMacroValue(MacroName: PChar; ValueStart, ValueEnd: integer); +var + i: LongInt; begin - + i:=IndexOfMacro(MacroName,false); + if i<0 then begin + // insert new macro + i:=IndexOfMacro(MacroName,true); + fMacroCapacity:=fMacroCapacity*2; + if fMacroCapacity<4 then fMacroCapacity:=4; + ReAllocMem(FMacros,SizeOf(TSourceLinkMakro)*fMacroCapacity); + if i