mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-07 08:50:35 +02:00
* Alternative approach for AddObject, which does not break backwards compatibility. Fixes issue #40899
This commit is contained in:
parent
2f0cd77d86
commit
8d5cf6ca5c
@ -1134,6 +1134,7 @@ type
|
||||
procedure InsertItem(Index: Integer; const S: string); virtual;
|
||||
procedure InsertItem(Index: Integer; const S: string; O: TObject); virtual;
|
||||
Function DoCompareText(const s1,s2 : string) : PtrInt; override;
|
||||
function DoAddObject(const S: string; AObject: TObject) : Integer; inline;
|
||||
public
|
||||
Constructor Create;
|
||||
Constructor Create(anOwnsObjects : Boolean);
|
||||
|
@ -1935,15 +1935,7 @@ begin
|
||||
Inherited destroy;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
function TStringList.Add(const S: string): Integer;
|
||||
|
||||
begin
|
||||
Result := AddObject(S, nil);
|
||||
end;
|
||||
|
||||
function TStringList.AddObject(const S: string; AObject: TObject): Integer;
|
||||
function TStringList.DoAddObject(const S: string; AObject: TObject): Integer;
|
||||
|
||||
begin
|
||||
If (SortStyle<>sslAuto) then
|
||||
@ -1957,6 +1949,18 @@ begin
|
||||
InsertItem (Result,S,AObject);
|
||||
end;
|
||||
|
||||
function TStringList.Add(const S: string): Integer;
|
||||
|
||||
begin
|
||||
Result:=DoAddObject(S, nil);
|
||||
end;
|
||||
|
||||
function TStringList.AddObject(const S: string; AObject: TObject): Integer;
|
||||
|
||||
begin
|
||||
Result:=DoAddObject(S,aObject);
|
||||
end;
|
||||
|
||||
procedure TStringList.Clear;
|
||||
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user