mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 15:49:16 +02:00
In tai_string.getcopy added zero-terminator only when needed
This commit is contained in:
parent
a9309072db
commit
d4bdb96163
@ -2415,9 +2415,14 @@ implementation
|
|||||||
p : tlinkedlistitem;
|
p : tlinkedlistitem;
|
||||||
begin
|
begin
|
||||||
p:=inherited getcopy;
|
p:=inherited getcopy;
|
||||||
|
if (len>0) and (str[len-1]=#0) then
|
||||||
|
getmem(tai_string(p).str,len)
|
||||||
|
else
|
||||||
|
begin
|
||||||
getmem(tai_string(p).str,len+1);
|
getmem(tai_string(p).str,len+1);
|
||||||
move(str^,tai_string(p).str^,len);
|
|
||||||
tai_string(p).str[len]:=#0;
|
tai_string(p).str[len]:=#0;
|
||||||
|
end;
|
||||||
|
move(str^,tai_string(p).str^,len);
|
||||||
getcopy:=p;
|
getcopy:=p;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user