public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r15-397] ada: Simplify uses of readdir_gnat with object overlay
@ 2024-05-13 8:35 Marc Poulhi?s
0 siblings, 0 replies; only message in thread
From: Marc Poulhi?s @ 2024-05-13 8:35 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:a14dc3e9b0e4300b58f03d9c5ea83758f912e909
commit r15-397-ga14dc3e9b0e4300b58f03d9c5ea83758f912e909
Author: Piotr Trojanek <trojanek@adacore.com>
Date: Wed Jun 15 17:41:00 2022 +0200
ada: Simplify uses of readdir_gnat with object overlay
Code cleanup; behavior is unaffected.
gcc/ada/
* libgnat/a-direct.adb (Start_Search_Internal): Combine subtype
and object declaration.
* libgnat/g-dirope.adb (Read): Replace convoluted unchecked
conversion with an overlay.
Diff:
---
gcc/ada/libgnat/a-direct.adb | 4 +---
gcc/ada/libgnat/g-dirope.adb | 18 ++++--------------
2 files changed, 5 insertions(+), 17 deletions(-)
diff --git a/gcc/ada/libgnat/a-direct.adb b/gcc/ada/libgnat/a-direct.adb
index 9e399c1003e7..32e020c48c37 100644
--- a/gcc/ada/libgnat/a-direct.adb
+++ b/gcc/ada/libgnat/a-direct.adb
@@ -1367,9 +1367,7 @@ package body Ada.Directories is
-- the Filter add it to our search vector.
declare
- subtype File_Name_String is String (1 .. File_Name_Len);
-
- File_Name : constant File_Name_String
+ File_Name : constant String (1 .. File_Name_Len)
with Import, Address => File_Name_Addr;
begin
diff --git a/gcc/ada/libgnat/g-dirope.adb b/gcc/ada/libgnat/g-dirope.adb
index 428d27d9e8de..d8ac0ec06f87 100644
--- a/gcc/ada/libgnat/g-dirope.adb
+++ b/gcc/ada/libgnat/g-dirope.adb
@@ -34,7 +34,6 @@ with Ada.Characters.Handling;
with Ada.Strings.Fixed;
with Ada.Unchecked_Deallocation;
-with Ada.Unchecked_Conversion;
with System; use System;
with System.CRTL; use System.CRTL;
@@ -677,24 +676,15 @@ package body GNAT.Directory_Operations is
end if;
declare
- subtype Path_String is String (1 .. Filename_Len);
- type Path_String_Access is not null access constant Path_String;
-
- function Address_To_Access is new
- Ada.Unchecked_Conversion
- (Source => Address,
- Target => Path_String_Access);
-
- Path_Access : constant Path_String_Access :=
- Address_To_Access (Filename_Addr);
-
+ Filename : constant String (1 .. Filename_Len)
+ with Import, Address => Filename_Addr;
begin
if Str'Length > Filename_Len then
Last := Str'First + Filename_Len - 1;
- Str (Str'First .. Last) := Path_Access.all;
+ Str (Str'First .. Last) := Filename;
else
Last := Str'Last;
- Str := Path_Access (1 .. Str'Length);
+ Str := Filename (1 .. Str'Length);
end if;
end;
end Read;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-05-13 8:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-13 8:35 [gcc r15-397] ada: Simplify uses of readdir_gnat with object overlay Marc Poulhi?s
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).