Browse Source

* make StdOut/StdErr optionally a true alias of Output/ErrOutput, so they share the same underlying TextRec. this reduces data segment usage on small systems by more than 1K.

git-svn-id: trunk@38196 -
Károly Balogh 7 years ago
parent
commit
07513150e0
2 changed files with 12 additions and 1 deletions
  1. 2 0
      rtl/inc/system.inc
  2. 10 1
      rtl/inc/systemh.inc

+ 2 - 0
rtl/inc/system.inc

@@ -1012,10 +1012,12 @@ begin
     Flush(Output);
   if Textrec(ErrOutput).Mode=fmOutput then
     Flush(ErrOutput);
+{$ifndef FPC_STDOUT_TRUE_ALIAS}
   if Textrec(stdout).Mode=fmOutput then
     Flush(stdout);
   if Textrec(StdErr).Mode=fmOutput then
     Flush(StdErr);
+{$endif FPC_STDOUT_TRUE_ALIAS}
 end;
 {$endif FPC_HAS_FEATURE_CONSOLEIO}
 

+ 10 - 1
rtl/inc/systemh.inc

@@ -766,9 +766,18 @@ Var
   { Standard In- and Output }
   ErrOutput,
   Output,
-  Input,
+  Input       : Text;
+{$ifndef FPC_STDOUT_TRUE_ALIAS}
   StdOut,
   StdErr      : Text;
+{$else FPC_STDOUT_TRUE_ALIAS}
+  { Optionally, make StdOut and StdErr a true alias of Output
+    and ErrOutput. This is benefical on small systems where the
+    data segment size is limited, as it lessens the RTL's data
+    size by a bit more than 1K. }
+  StdOut      : Text Absolute Output;
+  StdErr      : Text Absolute ErrOutput;
+{$endif FPC_STDOUT_TRUE_ALIAS}
   InOutRes    : Word;
   { Stack checking }
   StackBottom : Pointer;