]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
s-os_lib.ads, [...] (Normalize_Pathname): Do not compute Reference_Dir unless we...
authorEmmanuel Briot <briot@adacore.com>
Thu, 13 Dec 2007 10:43:51 +0000 (11:43 +0100)
committerArnaud Charlet <charlet@gcc.gnu.org>
Thu, 13 Dec 2007 10:43:51 +0000 (11:43 +0100)
2007-12-06  Emmanuel Briot  <briot@adacore.com>

* s-os_lib.ads, s-os_lib.adb (Normalize_Pathname): Do not compute
Reference_Dir unless we actually need it.

From-SVN: r130875

gcc/ada/s-os_lib.adb
gcc/ada/s-os_lib.ads

index af4c394b47b511d7135e9bf3fa19aabae51c6b7e..7082ff0930c9c795645807217b6b8b6a8fb0f478 100755 (executable)
@@ -1822,9 +1822,6 @@ package body System.OS_Lib is
          end if;
       end Get_Directory;
 
-      Reference_Dir : constant String := Get_Directory (Directory);
-      --  Current directory name specified
-
    --  Start of processing for Normalize_Pathname
 
    begin
@@ -1927,12 +1924,18 @@ package body System.OS_Lib is
          if Last = 1
            and then not Is_Absolute_Path (Path_Buffer (1 .. End_Path))
          then
-            Path_Buffer
-              (Reference_Dir'Length + 1 .. Reference_Dir'Length + End_Path) :=
+            declare
+               Reference_Dir : constant String  := Get_Directory (Directory);
+               Ref_Dir_Len   : constant Natural := Reference_Dir'Length;
+               --  Current directory name specified and its length
+
+            begin
+               Path_Buffer (Ref_Dir_Len + 1 .. Ref_Dir_Len + End_Path) :=
                  Path_Buffer (1 .. End_Path);
-            End_Path := Reference_Dir'Length + End_Path;
-            Path_Buffer (1 .. Reference_Dir'Length) := Reference_Dir;
-            Last := Reference_Dir'Length;
+               End_Path := Ref_Dir_Len + End_Path;
+               Path_Buffer (1 .. Ref_Dir_Len) := Reference_Dir;
+               Last := Ref_Dir_Len;
+            end;
          end if;
 
          Start  := Last + 1;
index bde73fdc6164abaa10f0cd8d1a96eb6e422c83eb..e3c1079df19b12e0b0a6cc447f89ea2bd4dfcdf0 100755 (executable)
@@ -507,6 +507,7 @@ package System.OS_Lib is
    --  directories listed in the environment Path. If the Exec_Name doesn't
    --  have the executable suffix, it will be appended before the search.
    --  Otherwise works like Locate_Regular_File below.
+   --  If the executable is not found, null is returned.
    --
    --  Note that this function allocates some memory for the returned value.
    --  This memory needs to be deallocated after use.
@@ -654,9 +655,9 @@ package System.OS_Lib is
    --  (notably Unix systems) a simple file name may also work (if the
    --  executable can be located in the path).
    --
-   --  "Spawn" should not be used in tasking applications. Why not??? More
-   --  documentation would be helpful here ??? Is it really tasking programs,
-   --  or tasking activity that cause trouble ???
+   --  "Spawn" should be avoided in tasking applications, since there are
+   --  subtle interactions between creating a process and signals/locks
+   --  that can cause troubles.
    --
    --  Note: Arguments in Args that contain spaces and/or quotes such as
    --  "--GCC=gcc -v" or "--GCC=""gcc -v""" are not portable across all