Commit 1d5a85bd by Robert Dewar Committed by Arnaud Charlet

a-caldel-vms.adb, [...]: Minor code reorganization (use conditional expressions).

2009-08-17  Robert Dewar  <dewar@adacore.com>

	* a-caldel-vms.adb, a-calend-vms.adb, a-calfor.adb, a-cdlili.adb,
	a-chahan.adb, a-cidlli.adb, a-coinve.adb, a-comlin.adb: Minor code
	reorganization (use conditional expressions).

From-SVN: r150834
parent b01bf852
2009-08-17 Robert Dewar <dewar@adacore.com>
* a-caldel-vms.adb, a-calend-vms.adb, a-calfor.adb, a-cdlili.adb,
a-chahan.adb, a-cidlli.adb, a-coinve.adb, a-comlin.adb: Minor code
reorganization (use conditional expressions).
2009-08-17 Robert Dewar <dewar@adacore.com>
* make.adb: Add ??? comment
* tbuild.adb: Minor reformatting
......
......@@ -7,7 +7,7 @@
-- B o d y --
-- --
-- Copyright (C) 1991-1994, Florida State University --
-- Copyright (C) 1995-2008, AdaCore --
-- Copyright (C) 1995-2009, AdaCore --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -79,15 +79,10 @@ package body Ada.Calendar.Delays is
-- A value distant enough to emulate "end of time" but which does not
-- cause overflow.
Safe_T : Time;
Safe_T : constant Time :=
(if T > Safe_Ada_High then Safe_Ada_High else T);
begin
if T > Safe_Ada_High then
Safe_T := Safe_Ada_High;
else
Safe_T := T;
end if;
return OSP.To_Duration (OSP.OS_Time (Safe_T), OSP.Absolute_Calendar);
end To_Duration;
......
......@@ -921,11 +921,7 @@ package body Ada.Calendar is
-- Step 3: Handle leap second occurrences
if Leap_Sec then
tm_sec := 60;
else
tm_sec := Second;
end if;
tm_Sec := (if Leap_Sec then 60 else Second);
end To_Struct_Tm;
------------------
......@@ -1195,11 +1191,10 @@ package body Ada.Calendar is
else
-- Sub second extraction
if Day_Secs > 0.0 then
Int_Day_Secs := Integer (Day_Secs - 0.5);
else
Int_Day_Secs := Integer (Day_Secs);
end if;
Int_Day_Secs :=
(if Day_Secs > 0.0
then Integer (Day_Secs - 0.5)
else Integer (Day_Secs));
H := Int_Day_Secs / 3_600;
Mi := (Int_Day_Secs / 60) mod 60;
......
......@@ -156,17 +156,8 @@ package body Ada.Calendar.Formatting is
-- Determine the two slice bounds for the result string depending on
-- whether the input is negative and whether fractions are requested.
if Elapsed_Time < 0.0 then
Low := 1;
else
Low := 2;
end if;
if Include_Time_Fraction then
High := 12;
else
High := 9;
end if;
Low := (if Elapsed_Time < 0.0 then 1 else 2);
High := (if Include_Time_Fraction then 12 else 9);
-- Prevent rounding when converting to natural
......@@ -457,11 +448,7 @@ package body Ada.Calendar.Formatting is
raise Constraint_Error;
end if;
if Seconds = 0.0 then
Secs := 0;
else
Secs := Natural (Seconds - 0.5);
end if;
Secs := (if Seconds = 0.0 then 0 else Natural (Seconds - 0.5));
Sub_Second := Second_Duration (Seconds - Day_Duration (Secs));
Hour := Hour_Number (Secs / 3_600);
......
......@@ -561,15 +561,9 @@ package body Ada.Containers.Doubly_Linked_Lists is
----------
procedure Sort (Front, Back : Node_Access) is
Pivot : Node_Access;
Pivot : constant Node_Access :=
(if Front = null then Container.First else Front.Next);
begin
if Front = null then
Pivot := Container.First;
else
Pivot := Front.Next;
end if;
if Pivot /= Back then
Partition (Pivot, Back);
Sort (Front, Pivot);
......
......@@ -457,11 +457,7 @@ package body Ada.Characters.Handling is
Substitute : ISO_646 := ' ') return ISO_646
is
begin
if Item in ISO_646 then
return Item;
else
return Substitute;
end if;
return (if Item in ISO_646 then Item else Substitute);
end To_ISO_646;
function To_ISO_646
......@@ -472,11 +468,8 @@ package body Ada.Characters.Handling is
begin
for J in Item'Range loop
if Item (J) in ISO_646 then
Result (J - (Item'First - 1)) := Item (J);
else
Result (J - (Item'First - 1)) := Substitute;
end if;
Result (J - (Item'First - 1)) :=
(if Item (J) in ISO_646 then Item (J) else Substitute);
end loop;
return Result;
......
......@@ -605,15 +605,9 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
----------
procedure Sort (Front, Back : Node_Access) is
Pivot : Node_Access;
Pivot : constant Node_Access :=
(if Front = null then Container.First else Front.Next);
begin
if Front = null then
Pivot := Container.First;
else
Pivot := Front.Next;
end if;
if Pivot /= Back then
Partition (Pivot, Back);
Sort (Front, Pivot);
......
......@@ -1171,7 +1171,6 @@ package body Ada.Containers.Indefinite_Vectors is
and then Index_Type'Last >= 0
then
CC := UInt (Index_Type'Last) + UInt (-Index_Type'First) + 1;
else
CC := UInt (Int (Index_Type'Last) - First + 1);
end if;
......@@ -1610,7 +1609,6 @@ package body Ada.Containers.Indefinite_Vectors is
and then Index_Type'Last >= 0
then
CC := UInt (Index_Type'Last) + UInt (-Index_Type'First) + 1;
else
CC := UInt (Int (Index_Type'Last) - First + 1);
end if;
......@@ -2283,15 +2281,9 @@ package body Ada.Containers.Indefinite_Vectors is
Item : Element_Type;
Index : Index_Type := Index_Type'Last) return Extended_Index
is
Last : Index_Type'Base;
Last : constant Index_Type'Base :=
(if Index > Container.Last then Container.Last else Index);
begin
if Index > Container.Last then
Last := Container.Last;
else
Last := Index;
end if;
for Indx in reverse Index_Type'First .. Last loop
if Container.Elements.EA (Indx) /= null
and then Container.Elements.EA (Indx).all = Item
......
......@@ -29,7 +29,9 @@
-- --
------------------------------------------------------------------------------
with System; use System;
pragma Compiler_Unit;
with System; use System;
package body Ada.Command_Line is
......@@ -71,7 +73,6 @@ package body Ada.Command_Line is
declare
Arg : aliased String (1 .. Len_Arg (Num));
begin
Fill_Arg (Arg'Address, Num);
return Arg;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment