From patchwork Tue May 18 21:01:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Buclaw X-Patchwork-Id: 1480551 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=Qw/+ykV8; 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 4Fl7hr45bYz9sSs for ; Wed, 19 May 2021 07:01:32 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6D5E3396C818; Tue, 18 May 2021 21:01:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6D5E3396C818 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1621371690; bh=de63xlbJRyeu2ir2wvE3YPL8b6k8QK0UMYxeoEJTc/Y=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=Qw/+ykV8rmN9iBQXaV38/lClphqMcwRQ/ulm6KB02VvNxviRy8xx+PKkxU0puZKJ6 +ijU0Hdjd7DAUHm6ka0NNWVpU34+wd0Ja+8O8CxSKHoptEzrMqlQW3ELGksyTlHYE3 m4n2r/WHbkYyT/Iv3p6EFR33aEh0/gDE+HnBIAf4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) by sourceware.org (Postfix) with ESMTPS id 3C2E2396C800 for ; Tue, 18 May 2021 21:01:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3C2E2396C800 Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:105:465:1:1:0]) (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-102.mailbox.org (Postfix) with ESMTPS id 4Fl7hj68l3zQjxW; Tue, 18 May 2021 23:01:25 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id 6_aqn3TWOxz8; Tue, 18 May 2021 23:01:16 +0200 (CEST) To: gcc-patches@gcc.gnu.org Subject: [committed] d: Use startswith function instead of strncmp Date: Tue, 18 May 2021 23:01:14 +0200 Message-Id: <20210518210114.551984-1-ibuclaw@gdcproject.org> MIME-Version: 1.0 X-MBO-SPAM-Probability: ****** X-Rspamd-Score: 8.68 / 15.00 / 15.00 X-Rspamd-Queue-Id: B56A118A8 X-Rspamd-UID: 446ac9 X-Spam-Status: No, score=-15.7 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 TypeVisitor in types.cc to use startswith instead of strncmp. Bootstrapped and regression tested on x86_64-linux-gnu, and committed to mainline. Regards, Iain. --- gcc/d/ChangeLog: * types.cc (TypeVisitor::visit (TypeEnum *)): Use startswith function instead of strncmp. --- gcc/d/types.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/d/types.cc b/gcc/d/types.cc index 3b121f5b042..ba2d6d4dc66 100644 --- a/gcc/d/types.cc +++ b/gcc/d/types.cc @@ -874,7 +874,7 @@ public: Type *underlying = NULL; /* Skip over the prefixing `__c_'. */ - gcc_assert (strncmp (ident, "__c_", strlen ("__c_")) == 0); + gcc_assert (startswith (ident, "__c_")); ident = ident + strlen ("__c_"); /* To keep things compatible within the code generation we stick to