mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 17:29:21 +02:00
* create only a single tai_string for shortstrings typed constants
whose type length is larger than the specified string * corrected place of ftcb.maybe_end_aggregate() call git-svn-id: branches/hlcgllvm@28134 -
This commit is contained in:
parent
23f34608ed
commit
2d335baab8
@ -532,24 +532,16 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
|
|||||||
strlength:=def.size-1;
|
strlength:=def.size-1;
|
||||||
end;
|
end;
|
||||||
ftcb.emit_tai(Tai_const.Create_8bit(strlength),cansichartype);
|
ftcb.emit_tai(Tai_const.Create_8bit(strlength),cansichartype);
|
||||||
{ this can also handle longer strings }
|
{ room for the string data + terminating #0 }
|
||||||
getmem(ca,strlength+1);
|
getmem(ca,def.size);
|
||||||
move(strval^,ca^,strlength);
|
move(strval^,ca^,strlength);
|
||||||
|
{ zero-terminate and fill with spaces if size is shorter }
|
||||||
|
fillchar(ca[strlength],def.size-strlength-1,' ');
|
||||||
ca[strlength]:=#0;
|
ca[strlength]:=#0;
|
||||||
ftcb.emit_tai(Tai_string.Create_pchar(ca,strlength),getarraydef(cansichartype,strlength+1));
|
ca[def.size-1]:=#0;
|
||||||
{ fillup with spaces if size is shorter }
|
ftcb.emit_tai(Tai_string.Create_pchar(ca,def.size-1),getarraydef(cansichartype,def.size-1));
|
||||||
if def.size>strlength then
|
|
||||||
begin
|
|
||||||
getmem(ca,def.size-strlength);
|
|
||||||
{ def.size contains also the leading length, so we }
|
|
||||||
{ we have to subtract one }
|
|
||||||
fillchar(ca[0],def.size-strlength-1,' ');
|
|
||||||
ca[def.size-strlength-1]:=#0;
|
|
||||||
{ this can also handle longer strings }
|
|
||||||
ftcb.emit_tai(Tai_string.Create_pchar(ca,def.size-strlength-1),getarraydef(cansichartype,def.size-strlength-1));
|
|
||||||
ftcb.maybe_end_aggregate(def);
|
ftcb.maybe_end_aggregate(def);
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
st_ansistring:
|
st_ansistring:
|
||||||
begin
|
begin
|
||||||
{ an empty ansi string is nil! }
|
{ an empty ansi string is nil! }
|
||||||
|
Loading…
Reference in New Issue
Block a user