|
@@ -501,6 +501,7 @@ Var
|
|
p,pc : pointer;
|
|
p,pc : pointer;
|
|
Size,NewLen,
|
|
Size,NewLen,
|
|
OldDestLen : SizeInt;
|
|
OldDestLen : SizeInt;
|
|
|
|
+ destcopy : widestring;
|
|
begin
|
|
begin
|
|
if high(sarr)=0 then
|
|
if high(sarr)=0 then
|
|
begin
|
|
begin
|
|
@@ -509,17 +510,19 @@ begin
|
|
end;
|
|
end;
|
|
lowstart:=low(sarr);
|
|
lowstart:=low(sarr);
|
|
if Pointer(DestS)=Pointer(sarr[lowstart]) then
|
|
if Pointer(DestS)=Pointer(sarr[lowstart]) then
|
|
|
|
+ inc(lowstart);
|
|
|
|
+ { Check for another reuse, then we can't use
|
|
|
|
+ the append optimization }
|
|
|
|
+ for i:=lowstart to high(sarr) do
|
|
begin
|
|
begin
|
|
- inc(lowstart);
|
|
|
|
- { Check for another reuse, then we can't use
|
|
|
|
- the append optimization }
|
|
|
|
- for i:=lowstart to high(sarr) do
|
|
|
|
|
|
+ if Pointer(DestS)=Pointer(sarr[i]) then
|
|
begin
|
|
begin
|
|
- if Pointer(DestS)=Pointer(sarr[i]) then
|
|
|
|
- begin
|
|
|
|
- lowstart:=low(sarr);
|
|
|
|
- break;
|
|
|
|
- end;
|
|
|
|
|
|
+ { if DestS is used somewhere in the middle of the expression,
|
|
|
|
+ we need to make sure the original string still exists after
|
|
|
|
+ we empty/modify DestS }
|
|
|
|
+ destcopy:=dests;
|
|
|
|
+ lowstart:=low(sarr);
|
|
|
|
+ break;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
{ Start with empty DestS if we start with concatting
|
|
{ Start with empty DestS if we start with concatting
|