diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-10-30 13:27:40 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-10-30 13:27:40 +0000 |
commit | ec40265d92e9db6dd4fac77cbe77138c3a5ebc35 (patch) | |
tree | 854f726823e2af6587eb683f740988813fd28f9a /gcc/ada/osint.adb | |
parent | c6d4a1059abf96f88cbcc63b31b92a12d83b28af (diff) | |
download | gcc-ec40265d92e9db6dd4fac77cbe77138c3a5ebc35.tar.gz |
2009-10-30 Robert Dewar <dewar@adacore.com>
* a-tideio.adb: Minor reformatting
* a-wtdeio.adb, a-ztdeio.adb: Update comments, code clean up.
* a-reatim.adb, a-tideau.adb, a-ngelfu.adb, a-ztdeau.adb, a-ngrear.adb,
a-wtedit.adb, a-ststio.adb, a-ztedit.adb: Minor code reorganization
(use conditional expressions).
2009-10-30 Ed Schonberg <schonberg@adacore.com>
* gnat_ugn.texi: Additional info on gnatw.i and gnatw.I
* sem_case.adb: Improved error message.
2009-10-30 Emmanuel Briot <briot@adacore.com>
* a-direct.adb, gnatcmd.adb, gnatname.adb, makeutl.adb, opt.ads,
osint.adb, prj-ext.adb, switch-m.adb (Follow_Links_For_Dirs): Now
defaults to False, and controlled by -eL.
* a-direct.adb: Add comments.
* osint.adb (File_Stamp): Avoid unneeded duplicate system call
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@153744 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/osint.adb')
-rw-r--r-- | gcc/ada/osint.adb | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/gcc/ada/osint.adb b/gcc/ada/osint.adb index a02e1eefe7e..a8db0a557a8 100644 --- a/gcc/ada/osint.adb +++ b/gcc/ada/osint.adb @@ -80,7 +80,8 @@ package body Osint is -- Appends Suffix to Name and returns the new name function OS_Time_To_GNAT_Time (T : OS_Time) return Time_Stamp_Type; - -- Convert OS format time to GNAT format time stamp + -- Convert OS format time to GNAT format time stamp. + -- Returns Empty_Time_Stamp if T is Invalid_Time function Executable_Prefix return String_Ptr; -- Returns the name of the root directory where the executable is stored. @@ -970,12 +971,13 @@ package body Osint is Get_Name_String (Name); - if not Is_Regular_File (Name_Buffer (1 .. Name_Len)) then - return Empty_Time_Stamp; - else - Name_Buffer (Name_Len + 1) := ASCII.NUL; - return OS_Time_To_GNAT_Time (File_Time_Stamp (Name_Buffer)); - end if; + -- File_Time_Stamp will always return Invalid_Time if the file does not + -- exist, and that OS_Time_To_GNAT_Time will convert that to + -- Empty_Time_Stamp. Therefore we do not need to first test whether the + -- file actually exists, which saves a system call + + return OS_Time_To_GNAT_Time + (File_Time_Stamp (Name_Buffer (1 .. Name_Len))); end File_Stamp; function File_Stamp (Name : Path_Name_Type) return Time_Stamp_Type is @@ -1887,6 +1889,10 @@ package body Osint is S : Second_Type; begin + if T = Invalid_Time then + return Empty_Time_Stamp; + end if; + GM_Split (T, Y, Mo, D, H, Mn, S); Make_Time_Stamp (Year => Nat (Y), |