mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 18:09:30 +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;
|
||||
begin
|
||||
p:=inherited getcopy;
|
||||
getmem(tai_string(p).str,len+1);
|
||||
if (len>0) and (str[len-1]=#0) then
|
||||
getmem(tai_string(p).str,len)
|
||||
else
|
||||
begin
|
||||
getmem(tai_string(p).str,len+1);
|
||||
tai_string(p).str[len]:=#0;
|
||||
end;
|
||||
move(str^,tai_string(p).str^,len);
|
||||
tai_string(p).str[len]:=#0;
|
||||
getcopy:=p;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user