mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-12-21 01:30:15 +00:00
Do not generate extra zero bytes after certain string constants.
These extra bytes are unnecessary after the changes in commit 5871820e0c
to make string constants explicitly include their null terminators.
The extra bytes would be generated for code like the following:
int main(void) {
static char *s1 = "abc", *s2 = "def", *s3 = "ghi";
}
This commit is contained in:
parent
02fbf97a1e
commit
e8d90a1b69
@ -674,12 +674,11 @@ case mode of
|
||||
GenImmediate2;
|
||||
sptr := icptr(name)^.pStr;
|
||||
j := sptr^.length;
|
||||
if maxString-stringSize >= j+1 then begin
|
||||
if maxString-stringSize >= j then begin
|
||||
for k := 1 to j do
|
||||
stringSpace[k+stringSize] :=
|
||||
sptr^.str[k];
|
||||
stringSpace[stringSize+j+1] := chr(0);
|
||||
stringSize := stringSize+j+1;
|
||||
stringSize := stringSize+j;
|
||||
end {if}
|
||||
else
|
||||
Error(cge3);
|
||||
|
Loading…
Reference in New Issue
Block a user