From nobody Sun Feb 8 13:17:19 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1602098662; cv=none; d=zohomail.com; s=zohoarc; b=POd3wqqTWNK0dTxN+PCmp7WbmuJ7ykjYIcszZZ6cNWHBowGY1W0pmAI6hMLKt/z9XgTnae9l/aTMBclOHCZpgynqHSDqrLOaZO5PjBFZFiJE7JCQp54aqf5DoymywskZHhqB/ywXmOFaI9USJceFvaWhxOBO5fTmuG1Gevf0uDc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602098662; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=CN4Er536MipBASO1jSZT+xj6dZLoDfWNtUJb6Ne+YTs=; b=bubdRoxyaUOsRYqk00NS9f4wt53vnOLOXXyBGzhyU1/YVDZ5eg/d+EneYbr+ES75ykKsZBDkhqoS0XMYkg7Oh9zVSZyNnUSWIam1Ww+LLkkLxLx0QvBPbqnbd0Hp2lOChbGOf5L4z48npeuOsCKwnTnTgBdWSls4xSze+cwwgqE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1602098662032448.96769452115086; Wed, 7 Oct 2020 12:24:22 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-302-TFf-weDSPXGIsd4aqBhV9Q-1; Wed, 07 Oct 2020 15:22:55 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3A6BD1084C9B; Wed, 7 Oct 2020 19:22:50 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 14D115C1C2; Wed, 7 Oct 2020 19:22:50 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D1ADD8C7B8; Wed, 7 Oct 2020 19:22:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 097JMdvh005941 for ; Wed, 7 Oct 2020 15:22:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id E4E841001281; Wed, 7 Oct 2020 19:22:39 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6D8BD100164C for ; Wed, 7 Oct 2020 19:22:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602098660; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=CN4Er536MipBASO1jSZT+xj6dZLoDfWNtUJb6Ne+YTs=; b=YH7lmPJmL6lJcbHpMErZWSWWnsifIz4k60Vnu4ED+pObbUFa9vIqCUljwHg9WeQlD6GGRi E2No9V4PeBTazfTtmX70cX6d1FiyT/NlkLUJe8Jh5gxFiVnnfbNNpdHFmxcg0qwKh8dVcr wkMn78d500/sdpH9L78CTQEsdpX+u60= X-MC-Unique: TFf-weDSPXGIsd4aqBhV9Q-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 07/13] conf: numa: use g_new0 Date: Wed, 7 Oct 2020 21:22:23 +0200 Message-Id: <181dfb1d09550c7b80a83c1c6ffe427cb7262fce.1602098503.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: J=C3=A1n Tomko --- src/conf/numa_conf.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c index 6653ba05a6..f8a7a01ac9 100644 --- a/src/conf/numa_conf.c +++ b/src/conf/numa_conf.c @@ -851,9 +851,7 @@ virDomainNumaDefNodeDistanceParseXML(virDomainNumaPtr d= ef, /* Apply the local / remote distance */ ldist =3D def->mem_nodes[cur_cell].distances; if (!ldist) { - if (VIR_ALLOC_N(ldist, ndistances) < 0) - goto cleanup; - + ldist =3D g_new0(virDomainNumaDistance, ndistances); ldist[cur_cell].value =3D LOCAL_DISTANCE; ldist[cur_cell].cellid =3D cur_cell; def->mem_nodes[cur_cell].ndistances =3D ndistances; @@ -866,9 +864,7 @@ virDomainNumaDefNodeDistanceParseXML(virDomainNumaPtr d= ef, /* Apply symmetry if none given */ rdist =3D def->mem_nodes[sibling_id].distances; if (!rdist) { - if (VIR_ALLOC_N(rdist, ndistances) < 0) - goto cleanup; - + rdist =3D g_new0(virDomainNumaDistance, ndistances); rdist[sibling_id].value =3D LOCAL_DISTANCE; rdist[sibling_id].cellid =3D sibling_id; def->mem_nodes[sibling_id].ndistances =3D ndistances; @@ -1005,8 +1001,7 @@ virDomainNumaDefParseXML(virDomainNumaPtr def, goto cleanup; } =20 - if (VIR_ALLOC_N(def->mem_nodes, n) < 0) - goto cleanup; + def->mem_nodes =3D g_new0(struct _virDomainNumaNode, n); def->nmem_nodes =3D n; =20 for (i =3D 0; i < n; i++) { @@ -1502,11 +1497,7 @@ virDomainNumaGetMaxCPUID(virDomainNumaPtr numa) virDomainNumaPtr virDomainNumaNew(void) { - virDomainNumaPtr ret =3D NULL; - - ignore_value(VIR_ALLOC(ret)); - - return ret; + return g_new0(virDomainNuma, 1); } =20 =20 @@ -1586,8 +1577,7 @@ virDomainNumaSetNodeCount(virDomainNumaPtr numa, size= _t nmem_nodes) return 0; } =20 - if (VIR_ALLOC_N(numa->mem_nodes, nmem_nodes) < 0) - return 0; + numa->mem_nodes =3D g_new0(struct _virDomainNumaNode, nmem_nodes); =20 numa->nmem_nodes =3D nmem_nodes; =20 @@ -1727,8 +1717,7 @@ virDomainNumaSetNodeDistanceCount(virDomainNumaPtr nu= ma, return 0; } =20 - if (VIR_ALLOC_N(distances, ndistances) < 0) - return 0; + distances =3D g_new0(struct _virDomainNumaDistance, ndistances); =20 numa->mem_nodes[node].distances =3D distances; numa->mem_nodes[node].ndistances =3D ndistances; --=20 2.26.2