From patchwork Tue May 18 21:00:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Buclaw X-Patchwork-Id: 1480549 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=ClDb0H2c; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Fl7gj6m4Sz9sV5 for ; Wed, 19 May 2021 07:00:33 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B66A4396C802; Tue, 18 May 2021 21:00:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B66A4396C802 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1621371630; bh=hmeWvD66OAglmZcf5pRRIhLRzthaduoxS4MHaeUNPfA=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=ClDb0H2cYyKGaVOteB8hkvv0z24LezLOEcSo9gG18eKZeG0zrlEmP/D7CaEE0UqkT aUpldqiL3zR6PMPGdaa4XZrIgCfRi4XyeOgNGporGneiKxLlbTDWXA2dqnwWZKkt/p gPJaK67kRrr+AvqMq5W39FtEBgBj7lzzMfKT9XOA= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mout-p-202.mailbox.org (mout-p-202.mailbox.org [80.241.56.172]) by sourceware.org (Postfix) with ESMTPS id 5A84E395B462 for ; Tue, 18 May 2021 21:00:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5A84E395B462 Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4Fl7gZ5Y0DzQjZh; Tue, 18 May 2021 23:00:26 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by gerste.heinlein-support.de (gerste.heinlein-support.de [91.198.250.173]) (amavisd-new, port 10030) with ESMTP id aFXysqI1x_69; Tue, 18 May 2021 23:00:23 +0200 (CEST) To: gcc-patches@gcc.gnu.org Subject: [committed] d: Use filename_ncmp instead of strncmp Date: Tue, 18 May 2021 23:00:22 +0200 Message-Id: <20210518210022.551784-1-ibuclaw@gdcproject.org> MIME-Version: 1.0 X-MBO-SPAM-Probability: * X-Rspamd-Score: 1.35 / 15.00 / 15.00 X-Rspamd-Queue-Id: D84E5181E X-Rspamd-UID: f83237 X-Spam-Status: No, score=-15.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Iain Buclaw via Gcc-patches From: Iain Buclaw Reply-To: Iain Buclaw Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi, This patch updates prefixed_path in d-incpath.cc to use filename_ncmp instead of strncmp. Bootstrapped and regression tested on x86_64-linux-gnu, and committed to mainline. Regards, Iain. --- gcc/d/ChangeLog: * d-incpath.cc (prefixed_path): Use filename_ncmp instead of strncmp. --- gcc/d/d-incpath.cc | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/gcc/d/d-incpath.cc b/gcc/d/d-incpath.cc index 8b7c4355a4a..d86392903e3 100644 --- a/gcc/d/d-incpath.cc +++ b/gcc/d/d-incpath.cc @@ -30,11 +30,9 @@ along with GCC; see the file COPYING3. If not see static char * prefixed_path (const char *path, const char *iprefix) { - size_t len; - - if (cpp_relocated () && (len = cpp_PREFIX_len) != 0) + if (cpp_relocated () && cpp_PREFIX_len != 0) { - if (!strncmp (path, cpp_PREFIX, len)) + if (!filename_ncmp (path, cpp_PREFIX, cpp_PREFIX_len)) { static const char *relocated_prefix; /* If this path starts with the configure-time prefix, @@ -52,14 +50,14 @@ prefixed_path (const char *path, const char *iprefix) free (dummy); } - return concat (relocated_prefix, path + len, NULL); + return concat (relocated_prefix, path + cpp_PREFIX_len, NULL); } } - if (iprefix && (len = cpp_GCC_INCLUDE_DIR_len) != 0) + if (iprefix && cpp_GCC_INCLUDE_DIR_len != 0) { - if (!strncmp (path, cpp_GCC_INCLUDE_DIR, len)) - return concat (iprefix, path + len, NULL); + if (!filename_ncmp (path, cpp_GCC_INCLUDE_DIR, cpp_GCC_INCLUDE_DIR_len)) + return concat (iprefix, path + cpp_GCC_INCLUDE_DIR_len, NULL); } return xstrdup (path);