From patchwork Wed Dec 28 16:27:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Llu=C3=ADs_Vilanova?= X-Patchwork-Id: 9490493 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9D9FE62AB0 for ; Wed, 28 Dec 2016 16:29:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 894BB262FF for ; Wed, 28 Dec 2016 16:29:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C75726538; Wed, 28 Dec 2016 16:29:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 262E9262FF for ; Wed, 28 Dec 2016 16:29:12 +0000 (UTC) Received: from localhost ([::1]:59890 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cMH6F-0001Qr-3B for patchwork-qemu-devel@patchwork.kernel.org; Wed, 28 Dec 2016 11:29:11 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44542) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cMH55-0000qQ-Jg for qemu-devel@nongnu.org; Wed, 28 Dec 2016 11:28:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cMH52-0005ym-GX for qemu-devel@nongnu.org; Wed, 28 Dec 2016 11:27:59 -0500 Received: from roura.ac.upc.edu ([147.83.33.10]:48684 helo=roura.ac.upc.es) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cMH52-0005yc-4Y for qemu-devel@nongnu.org; Wed, 28 Dec 2016 11:27:56 -0500 Received: from gw-3.ac.upc.es (gw-3.ac.upc.es [147.83.30.9]) by roura.ac.upc.es (8.13.8/8.13.8) with ESMTP id uBSGRtKW011508; Wed, 28 Dec 2016 17:27:55 +0100 Received: from localhost (unknown [84.88.51.85]) by gw-3.ac.upc.es (Postfix) with ESMTPSA id 0EDD1AA; Wed, 28 Dec 2016 17:27:55 +0100 (CET) From: =?utf-8?b?TGx1w61z?= Vilanova To: qemu-devel@nongnu.org Date: Wed, 28 Dec 2016 17:27:54 +0100 Message-Id: <148294247476.10801.6872060804640305909.stgit@fimbulvetr.bsc.es> X-Mailer: git-send-email 2.11.0 In-Reply-To: <148294246378.10801.8881527920302104439.stgit@fimbulvetr.bsc.es> References: <148294246378.10801.8881527920302104439.stgit@fimbulvetr.bsc.es> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by roura.ac.upc.es id uBSGRtKW011508 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 v5 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 , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Adds macro QTAILQ_FOREACH_CONTINUE to support incremental list traversal. Signed-off-by: LluĂ­s Vilanova --- include/qemu/queue.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/qemu/queue.h b/include/qemu/queue.h index 342073fb4d..ea6130f1c9 100644 --- a/include/qemu/queue.h +++ b/include/qemu/queue.h @@ -415,6 +415,18 @@ struct { \ (var); \ (var) = ((var)->field.tqe_next)) +/** + * 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) = ((var)->field.tqe_next); \ + (var); \ + (var) = ((var)->field.tqe_next)) + #define QTAILQ_FOREACH_SAFE(var, head, field, next_var) \ for ((var) = ((head)->tqh_first); \ (var) && ((next_var) = ((var)->field.tqe_next), 1); \