[COMMITTED] ada: Use generalized loop iteration in Put_Image routines
Checks
Commit Message
From: Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* libgnat/a-cidlli.adb (Put_Image): Simplify.
* libgnat/a-coinve.adb (Put_Image): Likewise.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/libgnat/a-cidlli.adb | 13 +++++--------
gcc/ada/libgnat/a-coinve.adb | 13 +++++--------
2 files changed, 10 insertions(+), 16 deletions(-)
@@ -1283,22 +1283,19 @@ is
is
First_Time : Boolean := True;
use System.Put_Images;
+ begin
+ Array_Before (S);
- procedure Put_Elem (Position : Cursor);
- procedure Put_Elem (Position : Cursor) is
- begin
+ for X of V loop
if First_Time then
First_Time := False;
else
Simple_Array_Between (S);
end if;
- Element_Type'Put_Image (S, Element (Position));
- end Put_Elem;
+ Element_Type'Put_Image (S, X);
+ end loop;
- begin
- Array_Before (S);
- Iterate (V, Put_Elem'Access);
Array_After (S);
end Put_Image;
@@ -2679,22 +2679,19 @@ is
is
First_Time : Boolean := True;
use System.Put_Images;
+ begin
+ Array_Before (S);
- procedure Put_Elem (Position : Cursor);
- procedure Put_Elem (Position : Cursor) is
- begin
+ for X of V loop
if First_Time then
First_Time := False;
else
Simple_Array_Between (S);
end if;
- Element_Type'Put_Image (S, Element (Position));
- end Put_Elem;
+ Element_Type'Put_Image (S, X);
+ end loop;
- begin
- Array_Before (S);
- Iterate (V, Put_Elem'Access);
Array_After (S);
end Put_Image;