From nobody Tue Feb 10 07:39:03 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=1599633491; cv=none; d=zohomail.com; s=zohoarc; b=Y2kIRuTJETzaw8isjKGmNNurtSnaM8IyTxW851GalOKAt4wjUUrh4QRw+ZOcEQ+j5rUKZP6VD6ZDZDxnwQcZ0VNbL3TemFPnTQ/+pxe0e0C6mGGp1fK0n6OERGfv2HbG+dhxhZZNJgGDGAfp8tgNPLLfOpNKb8E8kR4IUE1lRVQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599633491; h=Content-Type:Content-Transfer-Encoding:Cc: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=zJnUy+bdRy/JQvDDS5uVnre4pXnTDAbUrGcr/w0HnHs=; b=TIT9y6btsr+TT1kET+xg66KPFoo60K3m3f0PLcUyVPkYRQ12QP54S0pElwg8hAkV3BKkN2x5NYtQLRrQ0pKnfjJtHCz7qnFXyv2uIiqyo14ogREnd6drnD52vTdBTL077/dguGQ5v/A8HV7v3YV3g/Zm0JEdtr2PC3HgbbYEGCE= 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 1599633491577452.9506453299633; Tue, 8 Sep 2020 23:38:11 -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-127-2WvjIR1MN5mpCq5C_NcErQ-1; Wed, 09 Sep 2020 02:38:08 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 65C351091068; Wed, 9 Sep 2020 06:38:01 +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 3ACA327CC4; Wed, 9 Sep 2020 06:38:01 +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 CF9F07A018; Wed, 9 Sep 2020 06:38:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0896bvT0018286 for ; Wed, 9 Sep 2020 02:37:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id DDEAC83565; Wed, 9 Sep 2020 06:37:57 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-145.ams2.redhat.com [10.36.112.145]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3331883564; Wed, 9 Sep 2020 06:37:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599633490; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=zJnUy+bdRy/JQvDDS5uVnre4pXnTDAbUrGcr/w0HnHs=; b=fK8oQ8QR+nLK3tgB9onkp4i9QB33TnfUWhQVMkg2vUBWZP6QnewKByIRoNC3I3azUodF9B Ki1KOKjmTWDozntxYERKUfZB4oazgB6V1QiOCpeabYePhWntNp8Kf+KqFAi5NItlio7DgL M6BpHz+JQ0ceFL1JUiFWliwLKfHR5W0= X-MC-Unique: 2WvjIR1MN5mpCq5C_NcErQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH v2 1/2] cpu_map: Use g_auto* in loadData Date: Wed, 9 Sep 2020 08:37:50 +0200 Message-Id: <20200909063751.10103-2-twiederh@redhat.com> In-Reply-To: <20200909063751.10103-1-twiederh@redhat.com> References: <20200909063751.10103-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake --- src/cpu/cpu_map.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/cpu/cpu_map.c b/src/cpu/cpu_map.c index 3abec68c60..65d244e011 100644 --- a/src/cpu/cpu_map.c +++ b/src/cpu/cpu_map.c @@ -39,20 +39,19 @@ loadData(const char *mapfile, cpuMapLoadCallback callback, void *data) { - int ret =3D -1; VIR_XPATH_NODE_AUTORESTORE(ctxt) - xmlNodePtr *nodes =3D NULL; + g_autofree xmlNodePtr *nodes =3D NULL; int n; size_t i; int rv; =20 if ((n =3D virXPathNodeSet(element, ctxt, &nodes)) < 0) - goto cleanup; + return -1; =20 if (n > 0 && !callback) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Unexpected element '%s' in CPU map '%s'"), eleme= nt, mapfile); - goto cleanup; + return -1; } =20 for (i =3D 0; i < n; i++) { @@ -60,22 +59,17 @@ loadData(const char *mapfile, if (!name) { virReportError(VIR_ERR_INTERNAL_ERROR, _("cannot find %s name in CPU map '%s'"), eleme= nt, mapfile); - goto cleanup; + return -1; } VIR_DEBUG("Load %s name %s", element, name); ctxt->node =3D nodes[i]; rv =3D callback(ctxt, name, data); VIR_FREE(name); if (rv < 0) - goto cleanup; + return -1; } =20 - ret =3D 0; - - cleanup: - VIR_FREE(nodes); - - return ret; + return 0; } =20 static int --=20 2.26.2