From nobody Mon Feb 9 05:01:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1654154303; cv=none; d=zohomail.com; s=zohoarc; b=R+PzP6k7Qofs3HtgLiK7a23YtmykWs+nBQgukK+Yh/F4OZRa1bZ9ohkYtgRdXL9WgERh742pRNhTcipZV8QSNHAdG2TT/24yjUKMJVlzkzRxggFLrENjW4BiN2HERBvVo9kWbV9cUG8oB0M6YqYfVmA/EHOl89bEZm622oSOX5Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654154303; 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=vpel6P3+6VBnexb8vjBxIKL2BQkwLPYufomeXN+nA/U=; b=XwjXdOdv4kH0nIoXwp+45m5Gxea1VaRyprdLAdqp07Y8icSqeFNB6f+DpdJJ+DOGZ4JNFPuMyDJeo6FYVikDBIE9fgY0zeG+2TWndCJjlo5U1DHSqddzSaSJ1fWLAH86GjDoOWljdbaV9a5ie5bxTkUPZqxrtPLLz6j8+EJFEg8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1654154303311841.4601706111033; Thu, 2 Jun 2022 00:18:23 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-557-YKEFitXTMXyTByIJk7Xo6Q-1; Thu, 02 Jun 2022 03:18:20 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 317E2181E07C; Thu, 2 Jun 2022 07:18:17 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 15BD82026985; Thu, 2 Jun 2022 07:18:17 +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 BAE1E1954F66; Thu, 2 Jun 2022 07:18:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 91839194975B for ; Thu, 2 Jun 2022 07:18:15 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 8477C2166B26; Thu, 2 Jun 2022 07:18:15 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2C0642166B2D for ; Thu, 2 Jun 2022 07:18:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654154302; 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=vpel6P3+6VBnexb8vjBxIKL2BQkwLPYufomeXN+nA/U=; b=ZQtQ/TRrj11exvP+3G7e/qKhp2WCMj5h0pqkqL0x3XoKo+fLxvbkt3JBXjUralljuFUANC w6gDQEyA3eeGa8SXb/gHyL1pPUO7fmTVWhwP/SAVEyvkco8aH66QPa2Q25EaKsPHRxtFxT synF7U8gwjd7A0VaqWgCky3rWMCvl7w= X-MC-Unique: YKEFitXTMXyTByIJk7Xo6Q-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 06/16] conf: Introduce allocator for virDomainIOThreadIDDef Date: Thu, 2 Jun 2022 09:17:56 +0200 Message-Id: <71097166401fa94e9965d67667f07c65672c9aa7.1654154053.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 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.78 on 10.11.54.4 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: 1654154303708100001 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 c60ab4e064..8d4b27dbc0 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3476,6 +3476,15 @@ virDomainIOThreadIDArrayHasPin(virDomainDef *def) } =20 =20 +static virDomainIOThreadIDDef * +virDomainIOThreadIDDefNew(void) +{ + virDomainIOThreadIDDef *def =3D g_new0(virDomainIOThreadIDDef, 1); + + return def; +} + + void virDomainIOThreadIDDefFree(virDomainIOThreadIDDef *def) { @@ -3539,7 +3548,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= ); @@ -17008,7 +17017,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, @@ -22931,8 +22940,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