From nobody Wed Nov 5 15:57:12 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.zoho.com; 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 1497279351243920.1676248726602; Mon, 12 Jun 2017 07:55:51 -0700 (PDT) Received: from localhost ([::1]:38514 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dKQkt-0000cZ-Nk for importer@patchew.org; Mon, 12 Jun 2017 10:55:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57836) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dKQjP-00089Y-O4 for qemu-devel@nongnu.org; Mon, 12 Jun 2017 10:54:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dKQjL-0000P5-Ny for qemu-devel@nongnu.org; Mon, 12 Jun 2017 10:54:15 -0400 Received: from roura.ac.upc.edu ([147.83.33.10]:43053 helo=roura.ac.upc.es) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dKQjL-0000Oj-Bo for qemu-devel@nongnu.org; Mon, 12 Jun 2017 10:54:11 -0400 Received: from correu-1.ac.upc.es (correu-1.ac.upc.es [147.83.30.91]) by roura.ac.upc.es (8.13.8/8.13.8) with ESMTP id v5CEs9MD025660; Mon, 12 Jun 2017 16:54:09 +0200 Received: from localhost (unknown [132.68.137.174]) by correu-1.ac.upc.es (Postfix) with ESMTPSA id 123571419; Mon, 12 Jun 2017 16:54:03 +0200 (CEST) From: =?utf-8?b?TGx1w61z?= Vilanova To: qemu-devel@nongnu.org Date: Mon, 12 Jun 2017 17:54:02 +0300 Message-Id: <149727924253.28532.2681638904562623104.stgit@frigg.lan> X-Mailer: git-send-email 2.11.0 In-Reply-To: <149727922719.28532.11985025310576184920.stgit@frigg.lan> References: <149727922719.28532.11985025310576184920.stgit@frigg.lan> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by roura.ac.upc.es id v5CEs9MD025660 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-Received-From: 147.83.33.10 Subject: [Qemu-devel] [PATCH v6 2/6] queue: Add macro for incremental traversal 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: , Cc: Paolo Bonzini , Peter Crosthwaite , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Adds macro QTAILQ_FOREACH_CONTINUE to support incremental list traversal. Signed-off-by: Llu=C3=ADs Vilanova --- include/qemu/queue.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/qemu/queue.h b/include/qemu/queue.h index 35292c3155..eb2bf9cb1c 100644 --- a/include/qemu/queue.h +++ b/include/qemu/queue.h @@ -415,6 +415,18 @@ struct { = \ (var); \ (var) =3D ((var)->field.tqe_next)) =20 +/** + * QTAILQ_FOREACH_CONTINUE: + * @var: Variable to resume iteration from. + * @field: Field in @var holding a QTAILQ_ENTRY for this queue. + * + * Resumes iteration on a queue from the element in @var. + */ +#define QTAILQ_FOREACH_CONTINUE(var, field) \ + for ((var) =3D ((var)->field.tqe_next); \ + (var); \ + (var) =3D ((var)->field.tqe_next)) + #define QTAILQ_FOREACH_SAFE(var, head, field, next_var) \ for ((var) =3D ((head)->tqh_first); \ (var) && ((next_var) =3D ((var)->field.tqe_next), 1); \