From nobody Sat Feb 7 07:12:10 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1654696647; cv=none; d=zohomail.com; s=zohoarc; b=czXtLK7mWaw3CQ7m1fcHT4pRP1SInQbBHgF3yXEdFxB7aQQ0Lyq2S7QMGKg12RNIjNbO6gkW8gewSG74bF0FGzNjmgQu2kNm78SZd2zmwO0iP+7/QLOvmEEzXEmBFnoH+MrNS6O2cZr13cyBpn7/TA5VF2P7C7A2GUBegt5apIs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654696647; 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=Aq5merrOCZ9S3RBMyhPPwU4gdwid1xtDiEH/sLmkfCo=; b=YWSbCrq/VtVx97et7sxScSz1TeXo9xeP6sx4ZDkB+yzWFzUAJd5DXZlsMGzSyhFGyzQRRBvDJtbjiJd/ATuYFy+Ca4t4BKo1plLT92zgYeSABBYvAgti7wk5MNc2KueIKn6zvl3MCdDjdDemfQ8nYvB6ZbuZmsEfa/F6C6Ub4H4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1654696647725333.7819179033105; Wed, 8 Jun 2022 06:57:27 -0700 (PDT) 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-2-RRTh-s60OBeX30qT6hQ_gw-1; Wed, 08 Jun 2022 09:57:25 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E72E83C01D82; Wed, 8 Jun 2022 13:57:22 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id B8FDB492C3B; Wed, 8 Jun 2022 13:57:22 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 945DA1947051; Wed, 8 Jun 2022 13:57:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 17EBC1947040 for ; Wed, 8 Jun 2022 13:43:14 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 0B8D6492CA5; Wed, 8 Jun 2022 13:43:14 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id A68C0492C3B for ; Wed, 8 Jun 2022 13:43:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654696646; 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=Aq5merrOCZ9S3RBMyhPPwU4gdwid1xtDiEH/sLmkfCo=; b=FYqMttkusFU10oK4gKwQFhIcN/tWJvBHv5MweJ6TPAtNetmQZQ3M0ujx2uuq+cd8vUPNLX Nv/pSLCNjDWLl6YYuw98pJoFnNOmxEZnxFu0KYtcZHlAMOAt8j5QmCfBsN22vZcP3D4q4u 9ceKIZs0xiXfuIlCsbmHm9v6ThwPjzY= X-MC-Unique: RRTh-s60OBeX30qT6hQ_gw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v3 05/15] conf: Introduce allocator for virDomainIOThreadIDDef Date: Wed, 8 Jun 2022 15:42:59 +0200 Message-Id: <0f2ff3dfabce68e9f3218bc770aa3717e7c0a86e.1654695585.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1654696649417100001 Content-Type: text/plain; charset="utf-8"; x-default="true" So far, iothread configuration structure (virDomainIOThreadIDDef) is allocated by plain g_new0(). This is perfectly okay because all members of the struct default to value 0 anyway. But soon this is going to change. Therefore, replace those g_new0() with a function so that the default value can be set consistently in one place. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- src/conf/domain_conf.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f7b86be5fc..f3923cf2ba 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3477,6 +3477,15 @@ virDomainIOThreadIDArrayHasPin(virDomainDef *def) } =20 =20 +static virDomainIOThreadIDDef * +virDomainIOThreadIDDefNew(void) +{ + virDomainIOThreadIDDef *def =3D g_new0(virDomainIOThreadIDDef, 1); + + return def; +} + + void virDomainIOThreadIDDefFree(virDomainIOThreadIDDef *def) { @@ -3540,7 +3549,7 @@ virDomainIOThreadIDDefArrayInit(virDomainDef *def, _("failed to populate iothreadids")); return -1; } - iothrid =3D g_new0(virDomainIOThreadIDDef, 1); + iothrid =3D virDomainIOThreadIDDefNew(); iothrid->iothread_id =3D nxt; iothrid->autofill =3D true; def->iothreadids[def->niothreadids++] =3D g_steal_pointer(&iothrid= ); @@ -17009,7 +17018,7 @@ virDomainIdmapDefParseXML(xmlXPathContextPtr ctxt, static virDomainIOThreadIDDef * virDomainIOThreadIDDefParseXML(xmlNodePtr node) { - g_autoptr(virDomainIOThreadIDDef) iothrid =3D g_new0(virDomainIOThread= IDDef, 1); + g_autoptr(virDomainIOThreadIDDef) iothrid =3D virDomainIOThreadIDDefNe= w(); =20 if (virXMLPropUInt(node, "id", 10, VIR_XML_PROP_REQUIRED | VIR_XML_PROP_NONZERO, @@ -22932,8 +22941,7 @@ virDomainIOThreadIDAdd(virDomainDef *def, { virDomainIOThreadIDDef *iothrid =3D NULL; =20 - iothrid =3D g_new0(virDomainIOThreadIDDef, 1); - + iothrid =3D virDomainIOThreadIDDefNew(); iothrid->iothread_id =3D iothread_id; =20 VIR_APPEND_ELEMENT_COPY(def->iothreadids, def->niothreadids, iothrid); --=20 2.35.1