diff mbox

[Ada] Renaming of functions to check file's readability/writability

Message ID 20161012122739.GA98929@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet Oct. 12, 2016, 12:27 p.m. UTC
Old functions to check readability/writability of file based
on file's attributes had been replaced by new more precise
functions. Old functions are provided under new names.

Tested on x86_64-pc-linux-gnu, committed on trunk

2016-10-12  Vadim Godunko  <godunko@adacore.com>

	* s-os_lib.ads (Is_Owner_Readable_File): Renamed from
	Is_Readable_File.
	(Is_Owner_Writable_File): Renamed from Is_Writable_File.
	(Is_Readable_File): Renames Is_Read_Accessible_File.
	(Is_Writable_File): Renames Is_Write_Accessible_File.
diff mbox

Patch

Index: s-os_lib.adb
===================================================================
--- s-os_lib.adb	(revision 241024)
+++ s-os_lib.adb	(working copy)
@@ -1510,24 +1510,24 @@ 
       return Is_Read_Accessible_File (F_Name'Address) /= 0;
    end Is_Read_Accessible_File;
 
-   ----------------------
-   -- Is_Readable_File --
-   ----------------------
+   ----------------------------
+   -- Is_Owner_Readable_File --
+   ----------------------------
 
-   function Is_Readable_File (Name : C_File_Name) return Boolean is
+   function Is_Owner_Readable_File (Name : C_File_Name) return Boolean is
       function Is_Readable_File (Name : Address) return Integer;
       pragma Import (C, Is_Readable_File, "__gnat_is_readable_file");
    begin
       return Is_Readable_File (Name) /= 0;
-   end Is_Readable_File;
+   end Is_Owner_Readable_File;
 
-   function Is_Readable_File (Name : String) return Boolean is
+   function Is_Owner_Readable_File (Name : String) return Boolean is
       F_Name : String (1 .. Name'Length + 1);
    begin
       F_Name (1 .. Name'Length) := Name;
       F_Name (F_Name'Last)      := ASCII.NUL;
-      return Is_Readable_File (F_Name'Address);
-   end Is_Readable_File;
+      return Is_Owner_Readable_File (F_Name'Address);
+   end Is_Owner_Readable_File;
 
    ------------------------
    -- Is_Executable_File --
@@ -1601,24 +1601,24 @@ 
       return Is_Write_Accessible_File (F_Name'Address) /= 0;
    end Is_Write_Accessible_File;
 
-   ----------------------
-   -- Is_Writable_File --
-   ----------------------
+   ----------------------------
+   -- Is_Owner_Writable_File --
+   ----------------------------
 
-   function Is_Writable_File (Name : C_File_Name) return Boolean is
+   function Is_Owner_Writable_File (Name : C_File_Name) return Boolean is
       function Is_Writable_File (Name : Address) return Integer;
       pragma Import (C, Is_Writable_File, "__gnat_is_writable_file");
    begin
       return Is_Writable_File (Name) /= 0;
-   end Is_Writable_File;
+   end Is_Owner_Writable_File;
 
-   function Is_Writable_File (Name : String) return Boolean is
+   function Is_Owner_Writable_File (Name : String) return Boolean is
       F_Name : String (1 .. Name'Length + 1);
    begin
       F_Name (1 .. Name'Length) := Name;
       F_Name (F_Name'Last)      := ASCII.NUL;
-      return Is_Writable_File (F_Name'Address);
-   end Is_Writable_File;
+      return Is_Owner_Writable_File (F_Name'Address);
+   end Is_Owner_Writable_File;
 
    ----------
    -- Kill --
Index: s-os_lib.ads
===================================================================
--- s-os_lib.ads	(revision 241024)
+++ s-os_lib.ads	(working copy)
@@ -425,7 +425,7 @@ 
    --  not actually be readable due to some other process having exclusive
    --  access.
 
-   function Is_Readable_File (Name : String) return Boolean;
+   function Is_Owner_Readable_File (Name : String) return Boolean;
    --  Determines if the given string, Name, is the name of an existing file
    --  that is readable. Returns True if so, False otherwise. Note that this
    --  function simply interrogates the file attributes (e.g. using the C
@@ -449,7 +449,7 @@ 
    --  contains the name of the file to which it is linked. Symbolic links may
    --  span file systems and may refer to directories.
 
-   function Is_Writable_File (Name : String) return Boolean;
+   function Is_Owner_Writable_File (Name : String) return Boolean;
    --  Determines if the given string, Name, is the name of an existing file
    --  that is writable. Returns True if so, False otherwise. Note that this
    --  function simply interrogates the file attributes (e.g. using the C
@@ -465,6 +465,14 @@ 
    --  Determines if the given string, Name, is the name of an existing file
    --  that is writable. Returns True if so, False otherwise.
 
+   function Is_Readable_File (Name : String) return Boolean
+     renames Is_Read_Accessible_File;
+   function Is_Writable_File (Name : String) return Boolean
+     renames Is_Write_Accessible_File;
+   --  These subprograms provided for backward compatibility and should not be
+   --  used. Use Is_Owner_Readable_File/Is_Owner_Writable_File or
+   --  Is_Read_Accessible_File/Is_Write_Accessible_File instead.
+
    function Locate_Exec_On_Path (Exec_Name : String) return String_Access;
    --  Try to locate an executable whose name is given by Exec_Name in the
    --  directories listed in the environment Path. If the Exec_Name does not
@@ -683,10 +691,10 @@ 
 
    function Is_Directory (Name : C_File_Name) return Boolean;
    function Is_Executable_File (Name : C_File_Name) return Boolean;
-   function Is_Readable_File (Name : C_File_Name) return Boolean;
+   function Is_Owner_Readable_File (Name : C_File_Name) return Boolean;
    function Is_Regular_File (Name : C_File_Name) return Boolean;
    function Is_Symbolic_Link (Name : C_File_Name) return Boolean;
-   function Is_Writable_File (Name : C_File_Name) return Boolean;
+   function Is_Owner_Writable_File (Name : C_File_Name) return Boolean;
 
    function Locate_Regular_File
      (File_Name : C_File_Name;