From nobody Fri Nov 29 08:27:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1647273762; cv=none; d=zohomail.com; s=zohoarc; b=B9XIN1BfwXdBeL/sFrx5p27EkEetH9Hd1M4SRqELT6UaCMwvKhm+bdWpLpTrUba2nbSf/J+8dfvVVds/MEhjbqTok09HWp4yYR5qHc5Db59P/2bpMqQEslvHFRPEknDCTzv9/tR4biiq3lx8QrgDeGwiYIJdxupUX7mngVldReE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1647273762; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=489E4pWkjEIWhUhrxb8XebOf0gy71B5KdIis0MfEsAQ=; b=UM+vdQVh+BGTuxh4eTjNegxwyHnrtxPIJV3/DIddxuCz18qZtE764yOXEO8CuY6y/hZVhDrt8jascEDs0hHpXkWaHMBgIj9sMSVOHaSRvge/zh0LskdWKBf8VqHY5X89ixYL+ZS1QbgPlmiUj7XcHTErV2dLnz2GXaKnP0nUC9U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1647273762942184.36204122311142; Mon, 14 Mar 2022 09:02:42 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.290311.492335 (Exim 4.92) (envelope-from ) id 1nTn91-00053B-Mb; Mon, 14 Mar 2022 16:02:03 +0000 Received: by outflank-mailman (output) from mailman id 290311.492335; Mon, 14 Mar 2022 16:02:03 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nTn91-000534-JP; Mon, 14 Mar 2022 16:02:03 +0000 Received: by outflank-mailman (input) for mailman id 290311; Mon, 14 Mar 2022 16:02:02 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nTn8z-0004hK-U4 for xen-devel@lists.xenproject.org; Mon, 14 Mar 2022 16:02:02 +0000 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 14e8d663-a3b0-11ec-8eba-a37418f5ba1a; Mon, 14 Mar 2022 17:02:01 +0100 (CET) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-9-UabhmwAwMlifXCrqqDrRsA-1; Mon, 14 Mar 2022 12:01:55 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D33101C0E341; Mon, 14 Mar 2022 16:01:51 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.112.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CF56C2D47A; Mon, 14 Mar 2022 16:01:09 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id A56DA21D1F55; Mon, 14 Mar 2022 17:01:08 +0100 (CET) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 14e8d663-a3b0-11ec-8eba-a37418f5ba1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647273720; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=489E4pWkjEIWhUhrxb8XebOf0gy71B5KdIis0MfEsAQ=; b=ajIsXftbN4SdI5u5HZjuAqpT77hzOGnC/OQQwY3j821n1fh3E9lteZc1e+wVwC6NBKiAAu 6NJjGrHwpmDSO3mViRlh1bd/UJaXM1z5JlrEks7kUTCGDOyMCVeO90uULxPkGyMsHz2ybE EgOBfoGNC9msTLaJLVIFhlcvbrJ5Gb0= X-MC-Unique: UabhmwAwMlifXCrqqDrRsA-1 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Richard Henderson , Gerd Hoffmann , Christian Schoenebeck , "Gonglei (Arei)" , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" , Igor Mammedov , Ani Sinha , Laurent Vivier , Amit Shah , Peter Maydell , Stefano Stabellini , Anthony Perard , Paul Durrant , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Aleksandar Rikalo , Corey Minyard , Patrick Venture , Eduardo Habkost , Marcel Apfelbaum , Peter Xu , Jason Wang , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Daniel Henrique Barboza , David Gibson , Greg Kurz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jean-Christophe Dubois , Keith Busch , Klaus Jensen , Yuval Shaia , Yoshinori Sato , Magnus Damm , Fabien Chouteau , KONRAD Frederic , Mark Cave-Ayland , Artyom Tarasenko , Alex Williamson , Eric Auger , Max Filippov , Juan Quintela , "Dr. David Alan Gilbert" , Konstantin Kostiuk , Michael Roth , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Pavel Dovgalyuk , =?UTF-8?q?Alex=20Benn=C3=A9e?= , David Hildenbrand , Wenchao Wang , Colin Xu , Kamil Rytarowski , Reinoud Zandijk , Sunil Muthuswamy , Cornelia Huck , Thomas Huth , Eric Blake , Vladimir Sementsov-Ogievskiy , John Snow , kvm@vger.kernel.org, qemu-arm@nongnu.org, xen-devel@lists.xenproject.org, qemu-ppc@nongnu.org, qemu-block@nongnu.org, haxm-team@intel.com, qemu-s390x@nongnu.org Subject: [PATCH 1/3] scripts/coccinelle: New use-g_new-etc.cocci Date: Mon, 14 Mar 2022 17:01:06 +0100 Message-Id: <20220314160108.1440470-2-armbru@redhat.com> In-Reply-To: <20220314160108.1440470-1-armbru@redhat.com> References: <20220314160108.1440470-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1647273767536100001 Content-Type: text/plain; charset="utf-8" This is the semantic patch from commit b45c03f585 "arm: Use g_new() & friends where that makes obvious sense". Signed-off-by: Markus Armbruster Reviewed-by: Alex Benn=C3=A9e --- scripts/coccinelle/use-g_new-etc.cocci | 75 ++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 scripts/coccinelle/use-g_new-etc.cocci diff --git a/scripts/coccinelle/use-g_new-etc.cocci b/scripts/coccinelle/us= e-g_new-etc.cocci new file mode 100644 index 0000000000..e2280e93b3 --- /dev/null +++ b/scripts/coccinelle/use-g_new-etc.cocci @@ -0,0 +1,75 @@ +// Use g_new() & friends where that makes obvious sense +@@ +type T; +@@ +-g_malloc(sizeof(T)) ++g_new(T, 1) +@@ +type T; +@@ +-g_try_malloc(sizeof(T)) ++g_try_new(T, 1) +@@ +type T; +@@ +-g_malloc0(sizeof(T)) ++g_new0(T, 1) +@@ +type T; +@@ +-g_try_malloc0(sizeof(T)) ++g_try_new0(T, 1) +@@ +type T; +expression n; +@@ +-g_malloc(sizeof(T) * (n)) ++g_new(T, n) +@@ +type T; +expression n; +@@ +-g_try_malloc(sizeof(T) * (n)) ++g_try_new(T, n) +@@ +type T; +expression n; +@@ +-g_malloc0(sizeof(T) * (n)) ++g_new0(T, n) +@@ +type T; +expression n; +@@ +-g_try_malloc0(sizeof(T) * (n)) ++g_try_new0(T, n) +@@ +type T; +expression p, n; +@@ +-g_realloc(p, sizeof(T) * (n)) ++g_renew(T, p, n) +@@ +type T; +expression p, n; +@@ +-g_try_realloc(p, sizeof(T) * (n)) ++g_try_renew(T, p, n) +@@ +type T; +expression n; +@@ +-(T *)g_new(T, n) ++g_new(T, n) +@@ +type T; +expression n; +@@ +-(T *)g_new0(T, n) ++g_new0(T, n) +@@ +type T; +expression p, n; +@@ +-(T *)g_renew(T, p, n) ++g_renew(T, p, n) --=20 2.35.1