s-osprim-mingw.adb: Minor reformatting Minor code reorganization
authorRobert Dewar <dewar@adacore.com>
Tue, 7 Jul 2009 13:22:34 +0000 (13:22 +0000)
committerArnaud Charlet <charlet@gcc.gnu.org>
Tue, 7 Jul 2009 13:22:34 +0000 (15:22 +0200)
2009-07-07  Robert Dewar  <dewar@adacore.com>

* s-osprim-mingw.adb: Minor reformatting
Minor code reorganization

* a-stzsea.adb, a-stwise.adb, a-strsea.adb (Index): Redo previous change
(Ind should be Integer).

From-SVN: r149327

gcc/ada/ChangeLog
gcc/ada/a-strsea.adb
gcc/ada/a-stwise.adb
gcc/ada/a-stzsea.adb
gcc/ada/s-osprim-mingw.adb

index 4693dd40ad498df44a8e3882f5848f24e3609367..c22b4c7a01aaccb4aaccba1e4ffc0ac494455369 100644 (file)
@@ -1,3 +1,8 @@
+2009-07-07  Robert Dewar  <dewar@adacore.com>
+
+       * s-osprim-mingw.adb: Minor reformatting
+       Minor code reorganization
+
 2009-07-07  Robert Dewar  <dewar@adacore.com>
 
        * prj-nmsc.adb: Minor reformatting
index dbeb0e462a43d121e1b303e18b2acd335b679282..d6898331e91c4ca1018d1ed476b2e0d24d5e5afe 100644 (file)
@@ -238,7 +238,7 @@ package body Ada.Strings.Search is
       Mapping : Maps.Character_Mapping := Maps.Identity) return Natural
    is
       PL1 : constant Integer := Pattern'Length - 1;
-      Ind : Natural;
+      Ind : Integer; -- can be negative if Pattern'Length > Source'Length
       Cur : Natural;
 
    begin
@@ -246,12 +246,6 @@ package body Ada.Strings.Search is
          raise Pattern_Error;
       end if;
 
-      --  If Pattern longer than Source it can't be found
-
-      if Pattern'Length > Source'Length then
-         return 0;
-      end if;
-
       --  Forwards case
 
       if Going = Forward then
index 852b781233f25b8d6128443646cbd102e0105f8b..c5fb0be9abf609c8cc9d3744c2f95d1a65bb4548 100644 (file)
@@ -233,7 +233,7 @@ package body Ada.Strings.Wide_Search is
       return Natural
    is
       PL1 : constant Integer := Pattern'Length - 1;
-      Ind : Natural;
+      Ind : Integer; -- can be negative if Pattern'Length > Source'Length
       Cur : Natural;
 
    begin
@@ -241,12 +241,6 @@ package body Ada.Strings.Wide_Search is
          raise Pattern_Error;
       end if;
 
-      --  If Pattern longer than Source it can't be found
-
-      if Pattern'Length > Source'Length then
-         return 0;
-      end if;
-
       --  Forwards case
 
       if Going = Forward then
index d6341ae12004cb83e42a0cff880e8c7a5c5a49a5..4947896809c7c040d5261f5fac3fc6f092b5e1dd 100644 (file)
@@ -237,7 +237,7 @@ package body Ada.Strings.Wide_Wide_Search is
       return Natural
    is
       PL1 : constant Integer := Pattern'Length - 1;
-      Ind : Natural;
+      Ind : Integer; -- can be negative if Pattern'Length > Source'Length
       Cur : Natural;
 
    begin
@@ -245,12 +245,6 @@ package body Ada.Strings.Wide_Wide_Search is
          raise Pattern_Error;
       end if;
 
-      --  If Pattern longer than Source it can't be found
-
-      if Pattern'Length > Source'Length then
-         return 0;
-      end if;
-
       --  Forwards case
 
       if Going = Forward then
index 0984f49cacca550c31fe30ec0e5db9f44d7c7580..4a9161665358b0e8af92441540c3e51da685d771 100644 (file)
@@ -157,13 +157,10 @@ package body System.OS_Primitives is
       --  actions should be null.
 
       Max_Elapsed    : constant := 0;
-
       epoch_1970     : constant := 16#19D_B1DE_D53E_8000#; -- win32 UTC epoch
       system_time_ns : constant := 100;                    -- 100 ns per tick
       Sec_Unit       : constant := 10#1#E9;
-
       Test_Now       : aliased Long_Long_Integer;
-
       Loc_Ticks      : aliased LARGE_INTEGER;
       Loc_Time       : aliased Long_Long_Integer;
       Elapsed        : Long_Long_Integer;
@@ -181,8 +178,8 @@ package body System.OS_Primitives is
       --  time API.
 
       --  Try at most 10th times to reach the best synchronisation (below 1
-      --  millisecond) otherwise the runtime will use the best value
-      --  reached during the runs.
+      --  millisecond) otherwise the runtime will use the best value reached
+      --  during the runs.
 
       for K in 1 .. 10 loop
          GetSystemTimeAsFileTime (Loc_Time'Access);
@@ -219,17 +216,15 @@ package body System.OS_Primitives is
    function Monotonic_Clock return Duration is
       Current_Ticks  : aliased LARGE_INTEGER;
       Elap_Secs_Tick : Duration;
-
    begin
       if QueryPerformanceCounter (Current_Ticks'Access) = Win32.FALSE then
          return 0.0;
+      else
+         Elap_Secs_Tick :=
+           Duration (Long_Long_Float (Current_Ticks - BMTA.all) /
+                       Long_Long_Float (TFA.all));
+         return BMCA.all + Elap_Secs_Tick;
       end if;
-
-      Elap_Secs_Tick :=
-        Duration (Long_Long_Float (Current_Ticks - BMTA.all) /
-                  Long_Long_Float (TFA.all));
-
-      return BMCA.all + Elap_Secs_Tick;
    end Monotonic_Clock;
 
    -----------------