Browse Source

* Optimize posixtorunerror for size. Because inoutres is a threadvar, it
had an invisible code blowup.

git-svn-id: trunk@5006 -

daniel 19 years ago
parent
commit
b89cff5980
1 changed files with 29 additions and 23 deletions
  1. 29 23
      rtl/linux/sysos.inc

+ 29 - 23
rtl/linux/sysos.inc

@@ -79,43 +79,49 @@ end;
   correct value if an error has occured, else leave it untouched
   correct value if an error has occured, else leave it untouched
 }
 }
 
 
-Function PosixToRunError  (PosixErrno : longint) : longint;
+function PosixToRunError  (PosixErrno : longint):word;
 {
 {
   Convert ErrNo error to the correct Inoutres value
   Convert ErrNo error to the correct Inoutres value
 }
 }
 
 
+var r:word; {Inoutres is declared as word.}
+
 begin
 begin
-  if PosixErrNo=0 then { Else it will go through all the cases }
-   exit(0);
+(*
+  if PosixErrNo=0 then {Else it will go through all the cases}
+    exit(0);
+
+  Statement commented out. It will not go through all the cases. (DM)
+*)
   case PosixErrNo of
   case PosixErrNo of
-   ESysENFILE,
-   ESysEMFILE : Inoutres:=4;
-   ESysENOENT : Inoutres:=2;
-    ESysEBADF : Inoutres:=6;
-   ESysENOMEM,
-   ESysEFAULT : Inoutres:=217;
-   ESysEINVAL : Inoutres:=218;
+    ESysENFILE,
+    ESysEMFILE:         r:=4;
+    ESysENOENT:         r:=2;
+    ESysEBADF:          r:=6;
+    ESysENOMEM,
+    ESysEFAULT:         r:=217;
+    ESysEINVAL:         r:=218;
     ESysEPIPE,
     ESysEPIPE,
     ESysEINTR,
     ESysEINTR,
-      ESysEIO,
-   ESysEAGAIN,
-   ESysENOSPC : Inoutres:=101;
- ESysENAMETOOLONG : Inoutres := 3;
+    ESysEIO,
+    ESysEAGAIN,
+    ESysENOSPC:         r:=101;
+    ESysENAMETOOLONG:   r:=3;
     ESysEROFS,
     ESysEROFS,
-   ESysEEXIST,
-   ESysENOTEMPTY,
-   ESysEACCES : Inoutres:=5;
-   ESysEISDIR : InOutRes:=5;
+    ESysEEXIST,
+    ESysENOTEMPTY,
+    ESysEACCES:         r:=5;
+    ESysEISDIR:         r:=5;
   else
   else
-    begin
-       InOutRes := Integer(PosixErrno);
-    end;
+    r:=PosixErrno;
   end;
   end;
- PosixToRunError:=InOutRes;
+  inoutres:=r;
+  PosixToRunError:=r;
 end;
 end;
 
 
 
 
-Function Errno2InoutRes : longint;
+function Errno2InoutRes : word;
+
 begin
 begin
   Errno2InoutRes:=PosixToRunError(getErrno);
   Errno2InoutRes:=PosixToRunError(getErrno);
   InoutRes:=Errno2InoutRes;
   InoutRes:=Errno2InoutRes;