From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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) From: Iain Buclaw 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 Content-Transfer-Encoding: 8bit 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-List-Received-Date: Tue, 18 May 2021 21:00:29 -0000 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); -- 2.27.0