aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2022-03-26 00:11:35 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2022-05-30 08:29:04 +0000
commit263cb16b7667ba92fbac3098375aecfb7f80105e (patch)
treec9cbeef6c3ed18e85ea0fbb964ec34824ba13e2a /gcc
parent0f29dfcec26d883cb2d3d7ccdfc09bde1afcfa2e (diff)
downloadgcc-263cb16b7667ba92fbac3098375aecfb7f80105e.zip
gcc-263cb16b7667ba92fbac3098375aecfb7f80105e.tar.gz
gcc-263cb16b7667ba92fbac3098375aecfb7f80105e.tar.bz2
[Ada] Simplify construction of a path to file
Code cleanup; semantics is unaffected. gcc/ada/ * osint.adb (Locate_File): Change variable to constant and initialize it by concatenation of directory, file name and NUL.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/osint.adb10
1 files changed, 5 insertions, 5 deletions
diff --git a/gcc/ada/osint.adb b/gcc/ada/osint.adb
index a38ad78..eeedfcb 100644
--- a/gcc/ada/osint.adb
+++ b/gcc/ada/osint.adb
@@ -1886,13 +1886,13 @@ package body Osint is
end if;
declare
- Full_Name : String (1 .. Dir_Name'Length + Name'Length + 1);
+ Full_Name :
+ constant String (1 .. Dir_Name'Length + Name'Length + 1) :=
+ Dir_Name.all & Name & ASCII.NUL;
+ -- Use explicit bounds, because Dir_Name might be a substring whose
+ -- 'First is not 1.
begin
- Full_Name (1 .. Dir_Name'Length) := Dir_Name.all;
- Full_Name (Dir_Name'Length + 1 .. Full_Name'Last - 1) := Name;
- Full_Name (Full_Name'Last) := ASCII.NUL;
-
Attr.all := Unknown_Attributes;
if not Is_Regular_File (Full_Name'Address, Attr) then