[fpc-pascal] TStringList.Put calls change even if value hasn't changed
Bart
bartjunk64 at gmail.com
Sun Feb 10 17:29:05 CET 2013
When you do something like
StringList1.Strings[Index] := Value
it calls TStringList.Put().
I would expect that if Value = Strings[Index] then nothing happens,
and no Change or Changing are called.
Muttatis mutandis for PutObject.
Procedure TStringList.Put(Index: Integer; const S: string);
begin
If Sorted then
Error(SSortedListError,0);
If (Index<0) or (INdex>=Fcount) then
Error (SListIndexError,Index);
//First check for Flist^[Index].FString = S, and if so exit?
Changing;
Flist^[Index].FString:=S;
Changed;
end;
Procedure TStringList.PutObject(Index: Integer; AObject: TObject);
begin
If (Index<0) or (INdex>=Fcount) then
Error (SListIndexError,Index);
//First check for Flist^[Index].FObject equals AObject, and if so Exit?
Changing;
Flist^[Index].FObject:=AObject;
Changed;
end;
Of course I might be horribly wrong.
Can someone elaborate on this?
Bart
More information about the fpc-pascal
mailing list