From nobody Sun Feb 8 09:11:24 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1596473945; cv=none; d=zohomail.com; s=zohoarc; b=KGCycxX3fMaWffz4AUBVYJd2u4O/IyURIggHx+bLjIgJcbcmDbsoHoHBoZeO4Wc2DsMQoUkIWQM/uxcO5QzPbEsQNGPM/7zbhZdPAF+Q2F4P2wFxRieWNTottdXk0drxGrXsojwstA4/XwkozRWkpJD4LXv5d2r5ULWWCtFplQ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1596473945; 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=w+bhKKX5kLHoDDQ7TsAWe0mW4kPpLzZ0DLjhI2KbubU=; b=VpaZ/I6NhqjYQnaaGrC15tFP8Wd4AQCXZ9PRItJnXbCdhBDwpl1Au9YdITwH/X9kkkFvlePcmaw2qSfEsI63uhq87KnroU+TOgeiKz017NYDyJkQ9lxhx1kyY7j2LI1LVgA8A4j14DcdzYgzmrO7sGcQ5XVzaSAcxRhyr+9dvdM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1596473945536125.09480746085137; Mon, 3 Aug 2020 09:59:05 -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-502-Bw5sXbohMaiAv3prYhf24w-1; Mon, 03 Aug 2020 12:58:44 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E731B101C8A7; Mon, 3 Aug 2020 16:58:35 +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 CAD6871771; Mon, 3 Aug 2020 16:58:35 +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 9D1409A109; Mon, 3 Aug 2020 16:58:35 +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 073GvQDq007805 for ; Mon, 3 Aug 2020 12:57:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1832371770; Mon, 3 Aug 2020 16:57:26 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.40.208.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5D58D71778 for ; Mon, 3 Aug 2020 16:57:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596473944; 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=w+bhKKX5kLHoDDQ7TsAWe0mW4kPpLzZ0DLjhI2KbubU=; b=ieR1JaSS6LBHcT+izi3H3nyVTV30DG0E8y5M5mL8XaNDLIzSvHhoejkn1Yp19z+1ab9EFu QjGf6GBTypReRIGBYDv7pmE8Lfh5VClwOd357XP6h0O+6bsxfmERZhk/cszMsvYHe8wh8q yqps82nNYDSJN9Sk5u2vEi0/B/hxpGk= X-MC-Unique: Bw5sXbohMaiAv3prYhf24w-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 13/19] util: cgroup: wrap BACKEND_CALL macro in a block Date: Mon, 3 Aug 2020 18:56:50 +0200 Message-Id: <6a67653a3cc8c7f11ab552bfb4d6b719edd5c3fb.1596473604.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.15 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) VIR_CGROUP_BACKEND_CALL is exclusively used at the end of a function, but it declares a variable. Wrap it in a do..while block. Signed-off-by: J=C3=A1n Tomko --- src/util/vircgroupbackend.h | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/util/vircgroupbackend.h b/src/util/vircgroupbackend.h index e12a2e8b9d..bcbe435d78 100644 --- a/src/util/vircgroupbackend.h +++ b/src/util/vircgroupbackend.h @@ -452,15 +452,17 @@ virCgroupBackendForController(virCgroupPtr group, unsigned int controller); =20 #define VIR_CGROUP_BACKEND_CALL(group, controller, func, ret, ...) \ - virCgroupBackendPtr backend =3D virCgroupBackendForController(group, c= ontroller); \ - if (!backend) { \ - virReportError(VIR_ERR_INTERNAL_ERROR, \ - _("failed to get cgroup backend for '%s'"), #func);= \ - return ret; \ - } \ - if (!backend->func) { \ - virReportError(VIR_ERR_OPERATION_UNSUPPORTED, \ - _("operation '%s' not supported"), #func); \ - return ret; \ - } \ - return backend->func(group, ##__VA_ARGS__); + do { \ + virCgroupBackendPtr backend =3D virCgroupBackendForController(grou= p, controller); \ + if (!backend) { \ + virReportError(VIR_ERR_INTERNAL_ERROR, \ + _("failed to get cgroup backend for '%s'"), #fu= nc); \ + return ret; \ + } \ + if (!backend->func) { \ + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, \ + _("operation '%s' not supported"), #func); \ + return ret; \ + } \ + return backend->func(group, ##__VA_ARGS__); \ + } while (0) --=20 2.26.2