From e8d90a1b696e14edfb1f2da0d5b880ead006ff24 Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Sat, 29 Jan 2022 18:27:03 -0600 Subject: [PATCH] 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"; } --- Native.pas | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Native.pas b/Native.pas index 57b9a5c..53727af 100644 --- a/Native.pas +++ b/Native.pas @@ -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);