From nobody Tue Oct 28 02:10:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1516115706714402.8824971035307; Tue, 16 Jan 2018 07:15:06 -0800 (PST) Received: from localhost ([::1]:39938 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebSx7-0000Nc-S7 for importer@patchew.org; Tue, 16 Jan 2018 10:15:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50818) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebS4V-0003Tr-9w for qemu-devel@nongnu.org; Tue, 16 Jan 2018 09:18:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ebS4T-0005MG-Uy for qemu-devel@nongnu.org; Tue, 16 Jan 2018 09:18:38 -0500 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:44174) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ebS4T-0005LO-OF for qemu-devel@nongnu.org; Tue, 16 Jan 2018 09:18:37 -0500 Received: by mail-wm0-x241.google.com with SMTP id t74so8753825wme.3 for ; Tue, 16 Jan 2018 06:18:37 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-229-84.clienti.tiscali.it. [78.12.229.84]) by smtp.gmail.com with ESMTPSA id u10sm1537758wrg.6.2018.01.16.06.18.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jan 2018 06:18:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=T67IVZkHvup8WLIuFuILxNiMmQ9HflxMCrOAoRB/8xI=; b=bu69aEWDUz37nrn28oV4bLkQmFAlt0L7wBFkeWPTHrsrwoK/rxBYE/XfjWbRCUH+8M eXmWS2CjD1SrdAQGewOA2PB9w4aHcwKY0N3TRHn7ydW1GJwYn8tgSOm4Arl+wrT5/omR zHnY02NTGUfjVFMIzoSo7Qp1lcLvHCwFeoONuBwSTD82Wp0A/TpAgRJKT0tgqsT6Nysb VkwIhHMKrei68AQ1QwiofRUqT75m9qNk7ehbljQaVUGuEJc3256zkdLkhSYgv0xTg20G jWzghjg0PPlKiXOmrt3dZQouCVcNxi/9Tq4/fIySOE03Ze0kWufNZVCIGEnlc9+L+csK i1tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=T67IVZkHvup8WLIuFuILxNiMmQ9HflxMCrOAoRB/8xI=; b=QT0+3kAXx8wxm0ztERad4koTrsczrZ6rgDR7CJ4ch1wWt/clKbNf80vQmhsUCdiDtK lTPwr07lHgqv53Mv+rT5qfTCSGve1QVzwHeAenR518G39xOuWqTMf6ANyl6O9bQih8Ku jL/jdRCZINem3/24PtwHffhp7rd4EsfjmpSPm4Wm+fHM71NR65jYZR9n5lb24NRJb2Te NYZQ0w7s8HT/gEhWggcuniC8HKRGoUBifFI9Mqd1WKEp3nqVBb8sTiLpU1oD+l8Jp9Q9 OubG69PUNfPWdKA5drGHRzkn+AW+YXAlNnyJwz8+Ll/TSt1w+/+I1geaawHbadnr51Xa jqPQ== X-Gm-Message-State: AKwxytccVl0zze2/vtgVG554kUYiglzF5jpV1rWtbYXvACAnvDUj8+YA t2fUyPKCXUFkU38UiLfvm69bg/F0 X-Google-Smtp-Source: ACJfBotS0qjUEy/PCu5skBw8vF+kII8iiN2YF121tu53BIqjY1juzjk1KG5e1poKPvUjZ1eOKX6DXA== X-Received: by 10.28.91.10 with SMTP id p10mr13994006wmb.112.1516112316492; Tue, 16 Jan 2018 06:18:36 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 16 Jan 2018 15:17:24 +0100 Message-Id: <1516112253-14480-43-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1516112253-14480-1-git-send-email-pbonzini@redhat.com> References: <1516112253-14480-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 42/51] tests: Avoid 'do/while(false); ' in vhost-user-bridge X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Eric Blake Use of a do/while(0) loop as a way to allow break statements in the middle of execute-once code is unusual. More typical is the use of goto for early exits, with a label at the end of the execute-once code, rather than nesting code in a scope; however, the comment at the end of the existing code makes this alternative a bit unpractical. So, to avoid false positives from a future syntax check about 'while (false);', and to keep the loop form (in case someone ever does add DONTWAIT support, where they can just as easily manipulate the initial loop condition or add an if around the final 'break'), I opted to use the form of a while(1) loop (the break as an early exit is more idiomatic there), coupled with a final break preserving the original comment. Signed-off-by: Eric Blake Message-Id: <20171201232433.25193-6-eblake@redhat.com> Signed-off-by: Paolo Bonzini --- tests/vhost-user-bridge.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/vhost-user-bridge.c b/tests/vhost-user-bridge.c index d820033..e0605a5 100644 --- a/tests/vhost-user-bridge.c +++ b/tests/vhost-user-bridge.c @@ -283,7 +283,7 @@ vubr_backend_recv_cb(int sock, void *ctx) return; } =20 - do { + while (1) { struct iovec *sg; ssize_t ret, total =3D 0; unsigned int num; @@ -343,7 +343,9 @@ vubr_backend_recv_cb(int sock, void *ctx) =20 free(elem); elem =3D NULL; - } while (false); /* could loop if DONTWAIT worked? */ + + break; /* could loop if DONTWAIT worked? */ + } =20 if (mhdr_cnt) { mhdr.num_buffers =3D i; --=20 1.8.3.1