From patchwork Wed Oct 12 12:27:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 681155 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3svCnY1sMDz9s9c for ; Wed, 12 Oct 2016 23:28:17 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=vyBbcqVA; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=r7FHL2am/1HHEwi42kts3+GjxID1HDNioB0L+jhwJ5mRCLtz5V teyGk+1H+S0K9QAwQqNjHaVbx7t1EqyW25r8kCCNpPi+Rc37upHBvQ46ASRTQwFt 7xkFMw5LlAUjYfhsEXEebZLEbsUTKh1aI0XRg6GGQKHu5/QDMd/QtRrD8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=aEdD22MMkddp8rbkulfQj7XELBY=; b=vyBbcqVAzj2koTGktLvY BXvPi8LMLrGojWxAV3qwbhFgqjNmozvWXofow1daItnm01f6y7qWzS6fqwRepcyS EJoLIeJrDj+5Hap6y8Pat0Axvs16K8HVfSgrdN11qHiMkU/tmgj7RBaRhk8JTb+d 1JANdG0fM61ShKRgh3Pq9EI= Received: (qmail 71341 invoked by alias); 12 Oct 2016 12:27:46 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 71298 invoked by uid 89); 12 Oct 2016 12:27:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=BAYES_00, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=no version=3.3.2 spammy=determines, vadim, renames, Vadim X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 12 Oct 2016 12:27:41 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id EA0F2116A1A; Wed, 12 Oct 2016 08:27:39 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id AFXH0R0RleGj; Wed, 12 Oct 2016 08:27:39 -0400 (EDT) Received: from tron.gnat.com (tron.gnat.com [IPv6:2620:20:4000:0:46a8:42ff:fe0e:e294]) by rock.gnat.com (Postfix) with ESMTP id DA57411694E; Wed, 12 Oct 2016 08:27:39 -0400 (EDT) Received: by tron.gnat.com (Postfix, from userid 4192) id D942343D; Wed, 12 Oct 2016 08:27:39 -0400 (EDT) Date: Wed, 12 Oct 2016 08:27:39 -0400 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Vadim Godunko , Vasiliy Fofanov Subject: [Ada] Renaming of functions to check file's readability/writability Message-ID: <20161012122739.GA98929@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) 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 * 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. 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;