From patchwork Fri Aug 21 21:22:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 8361 Received: (qmail 109804 invoked by alias); 21 Aug 2015 21:22:07 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 109795 invoked by uid 89); 21 Aug 2015 21:22:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.6 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 21 Aug 2015 21:22:05 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 42B9560 for ; Fri, 21 Aug 2015 21:22:04 +0000 (UTC) Received: from host1.jankratochvil.net (ovpn-116-22.ams2.redhat.com [10.36.116.22]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t7LLM3qR016318 for ; Fri, 21 Aug 2015 17:22:03 -0400 Subject: [PATCH v12 13/32] Code cleanup: openp parameter filename_opened is never NULL From: Jan Kratochvil To: gdb-patches@sourceware.org Date: Fri, 21 Aug 2015 23:22:01 +0200 Message-ID: <20150821212201.6673.52138.stgit@host1.jankratochvil.net> In-Reply-To: <20150821212006.6673.35100.stgit@host1.jankratochvil.net> References: <20150821212006.6673.35100.stgit@host1.jankratochvil.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-IsSubscribed: yes Hi, this parameter is never passed as NULL in the codebase so the check can be removed. Jan gdb/ChangeLog 2015-08-18 Jan Kratochvil * source.c (openp): Update function comment for filename_opened. Remove NULL check for filename_opened. --- 0 files changed diff --git a/gdb/source.c b/gdb/source.c index 8dfe580..4096d0d 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -742,7 +742,7 @@ dirnames_to_char_ptr_vec_target_exc (const char *string) OPTS specifies the function behaviour in specific cases. - If FILENAME_OPENED is non-null, set it to a newly allocated string naming + FILENAME_OPENED must be non-null. Set it to a newly allocated string naming the actual file opened (this string will always start with a "/"). We have to take special pains to avoid doubling the "/" between the directory and the file, sigh! Emacs gets confuzzed by this when we print the @@ -901,13 +901,10 @@ openp (const char *path, enum openp_flags opts, const char *string, do_cleanups (back_to); done: - if (filename_opened) - { - if (fd < 0) - *filename_opened = NULL; - else - *filename_opened = xstrdup (filename); - } + if (fd < 0) + *filename_opened = NULL; + else + *filename_opened = xstrdup (filename); return fd; }